![d2e49abb20115588fb761f6707f6b3d9.png](https://img-blog.csdnimg.cn/img_convert/d2e49abb20115588fb761f6707f6b3d9.png)
iOS适配HTTPS注意点
- 网络请求NSURLConnection/NSURLSession
- H5页面适配WKWebView/UIWebView
- SDWebImage图片加载适配
网络请求部分
NSURLConnection适配
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; } else { if ([challenge previousFailureCount] == 0) { [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; } else { [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; } }}
NSURLSession适配
/** disposition:如何处理证书 NSURLSessionAuthChallengeUseCredential 使用证书 NSURLSession