我把我的应用程序上传到了iTunes上,它也是实时的,但是在一些设备上(主要是iPhone7)。在将Xcode或ios版本升级到11.4之后,我得到了SSL连接错误。
在iPhone6s或ipad上运行良好,但是在客户端iphone 7上出现了这种错误,出现了附加屏幕截图的错误,我无法理解发生了什么,需要改变什么。
我已经在信息plist中添加了这段代码
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>我们还检查服务器证书,它们也是有效的。

发布于 2018-06-18 10:48:39
首先检查端口是否存在SSL,并更正用于SSL固定的证书。
检查SSL代码
- (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];
}https://stackoverflow.com/questions/50905065
复制相似问题