Track redirects when using sendAsynchronousRequest: queue: completeHandler :?

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
+5
source share
1 answer

I do not think that you can replicate the behavior, since it sendAsynchronousRequestonly calls the completion handler specified in the code block.

, . sendAsynchronousRequest NSURLConnection, , ivar NSMutableData , , NSURLConnection, .

+1

All Articles