How can I call custom code when a redirect occurs when sending a request using the method:
+ (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler
?
I want to reproduce the behavior of the NSURLConnectionDelegate method:
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse
I do not think that you can replicate the behavior, since it sendAsynchronousRequestonly calls the completion handler specified in the code block.
sendAsynchronousRequest
, . sendAsynchronousRequest NSURLConnection, , ivar NSMutableData , , NSURLConnection, .
NSURLConnection