Created
December 30, 2015 09:53
-
-
Save TakayoshiMiyamoto/b9ad609e101d3a819bc9 to your computer and use it in GitHub Desktop.
NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
This file contains 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
#import <Foundation/Foundation.h> | |
@interface NSURLRequest (SelfSignedCertificate) | |
#ifdef DEBUG | |
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host; | |
#endif | |
@end |
This file contains 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
#import "NSURLRequest+SelfSignedCertificate.h" | |
@implementation NSURLRequest (SelfSignedCertificate) | |
#ifdef DEBUG | |
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host { | |
if ([host isEqualToString:@"localhost"]) { | |
// Use self-signed certificate. | |
return YES; | |
} | |
return NO; | |
} | |
#endif | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment