Skip to content

Instantly share code, notes, and snippets.

@edwardmp
Created May 22, 2015 16:08
Show Gist options
  • Save edwardmp/817a50d623310f159c88 to your computer and use it in GitHub Desktop.
Save edwardmp/817a50d623310f159c88 to your computer and use it in GitHub Desktop.
Allow use of self signed SSL certificate when using NSURLSession
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment