Created
October 23, 2012 09:01
-
-
Save mrmans0n/3937747 to your computer and use it in GitHub Desktop.
Accept all SSL certificates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { | |
| return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; | |
| } | |
| - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { | |
| if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) | |
| if ([trustedHosts containsObject:challenge.protectionSpace.host]) | |
| [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; | |
| [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment