NSURLSessionTask authentication challenge completionHandler and NSURLAuthenticationChallenge client
I am implementing a custom NSURLProtocol , and internally want to use NSURLSession with data tasks for internal networking instead of NSURLConnection . I have hit an interesting problem and wonder about the internal implementation of the challenge handler of NSURLSession / NSURLSessionTask . - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; Here I am basically provided with two