Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TakayoshiMiyamoto/b9ad609e101d3a819bc9 to your computer and use it in GitHub Desktop.
Save TakayoshiMiyamoto/b9ad609e101d3a819bc9 to your computer and use it in GitHub Desktop.
NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
#import <Foundation/Foundation.h>
@interface NSURLRequest (SelfSignedCertificate)
#ifdef DEBUG
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host;
#endif
@end
#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