我有时会在 iOS 7 下使用 AFNetworking 通过 HTTPS 连接看到 SSL 错误。
以下错误消息很少出现在控制台上:
An SSL error has occurred and a secure connection to the server cannot be made.
关联
CFNetwork SSLHandshake failed (-9806) NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9806)
或
CFNetwork SSLHandshake failed (-9810) NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9810)
关于 http://www.opensource.apple.com/source/Security/Security-55179.13/libsecurity_ssl/Security/SecureTransport.h您可以找到这些错误代码的解释:
errSSLClosedAbort = -9806, /* connection closed via error */
errSSLInternal = -9810, /* Internal error */
有人遇到过同样的问题吗?
今天 Apple 发布了 iOS 7.0.6,其中包含一个SSL 连接验证修复。
对我来说,这听起来与以下问题更相关: Receiving SSL error in iOS7 GM - "AddTrust External CA Root" is not trusted? (错误代码-9813)
但也许新的 iOS 版本带来了一些改进作为副作用......
编辑:在 iOS 7.0.6 中修复了另一个错误(if-else-if-statement 中的双重“goto fail”)。
最佳答案
所有 -9806 和 -9810 SSL 错误都是在使用(明显错误的)WWAN 连接时发生的。 使用 WLAN 连接时,设备上不会出现此类错误。
然而,特定的 HTTPS 任务在一段时间后完成! 所以对于我们来说,我们可以忽略这些错误。
关于ios - iOS 7 下的 SSL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21943576/