Skip to content

Instantly share code, notes, and snippets.

@takeshiyako2
Last active February 7, 2017 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takeshiyako2/8e21d062090a6f8b97dbb58a3e6e0c44 to your computer and use it in GitHub Desktop.
Save takeshiyako2/8e21d062090a6f8b97dbb58a3e6e0c44 to your computer and use it in GitHub Desktop.
iOS Objective-C against kCFStreamErrorDomainSSL error
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
2017-02-07 10:49:25.250 App[46178:1264401] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
2017-02-07 10:49:25.253 App[46178:1264332] FADHttp failed -1200: https://mydomain/ An SSL error has occurred and a secure connection to the server cannot be made.
#import <Foundation/Foundation.h>
#ifdef DEBUG
@interface NSURLRequest (SSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
@end
#endif
#import "NSURLRequestOverrideNotSecureSSL.h"
#ifdef DEBUG
@implementation NSURLRequest(SSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host {
return YES;
}
@end
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment