当我打开我的应用程序一段时间后,我收到日志:
440:(0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-758.4.3/Loading/URLConnectionLoader.cpp:289)内部错误CFNetwork
它从来没有出现在过去。我的项目使用网络库AFNetworking和CocoaAsyncSocket。
为什么会发生这种情况,以及如何解决?
发布于 2016-07-13 06:06:22
我解决了我的问题,这不是AFNetwork的问题,我使用无效的SSL认证和SDWebImage,当在SDWebImage中使用'SDWebImageAllowInvalidSSLCertificates‘选项并得到一个http映像(而不是https映像)时,您将得到这个错误。SDWebImage无法自动识别协议(http或https)。
我的解决方案:我不改变SDWebImage的代码,我只是为可识别的协议(http或https)编写了一个包装器。我对http图像使用'0‘选项,对https图像使用'SDWebImageAllowInvalidSSLCertificates’选项(我的https认证是自签名的或无效的)。如果你的SDWebImage是有效的,我认为它很好。
发布于 2017-07-17 15:37:22
我通过在info.plist中添加以下属性解决了这个问题
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>http://mydomain</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>https://stackoverflow.com/questions/38050726
复制相似问题