App Transport Security 被禁用并且仍然收到 SSL 握手错误

App Transport Security disabled and still getting SSL Handshake Error

我无法通过 HTTPS/SSL 连接到 API。我已经使用下面的字典完全禁用了 App Transport Security (ATS)(尽管 SSL 证书通过了 NSCURL 的所有测试)。

<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
</plist>

但是:仍然存在一个 SSL 握手错误(下方),当用 Google 搜索时,只表明它与应用程序传输安全有关。

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

我已经创建了一个演示该问题的最小示例项目,available on GitHub (https://github.com/samheather/AppTransportSecurityDemo)。您应该会发现,在 运行 项目上,它会在几秒钟内崩溃(在它尝试在 viewDidLoad 中建立连接后立即崩溃)。

我尝试连接的域是 https://demo.heather.sh, and a sample URL that the certificate that has a response (so the certificate can be viewed) is https://demo.heather.sh:443/checkOnline

有什么想法吗?

谢谢!

山姆

所述,问题是服务器未提供结合了中间证书的证书。现在这个问题已经解决,一切正常:)

正如 Anand(上文)所说,一个很好的检查工具是:http://ssllabs.com/ssltest/analyze.html?d=