Skip to content

Instantly share code, notes, and snippets.

@tigi44
Last active January 26, 2021 03:07
Show Gist options
  • Save tigi44/7a2eca524005af62af677d6f82e3f7e5 to your computer and use it in GitHub Desktop.
Save tigi44/7a2eca524005af62af677d6f82e3f7e5 to your computer and use it in GitHub Desktop.
NSURLSession - ignore auth ssl
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:[NSOperationQueue mainQueue]];
// <NSURLSessionTaskDelegate>
- (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