CFNetwork internal error : URLConnectionLoader.cpp:289

喜夏-厌秋 提交于 2020-01-01 09:18:13

问题


When I open my application after a while, I received log:

440: CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork-758.4.3/Loading/URLConnectionLoader.cpp:289)

It has never been out in the past. My project uses a network library AFNetworking and CocoaAsyncSocket.

Why does it occur and how to fix it?


回答1:


I solved my situation, it is not AFNetwork's issue, I use a invalid SSL certification and SDWebImage, when use the option 'SDWebImageAllowInvalidSSLCertificates' in SDWebImage and get a http image (not https image), you will get this error. the protocol (http or https) not being recognized automaticly by SDWebImage.

my solution: I not change SDWebImage’s code, I just write a wrapper for recognized protocol (http or https). I use '0' option for http images and 'SDWebImageAllowInvalidSSLCertificates' option for https images (my https certification is self signed or invalid). If yours cer is valid , I think SDWebImage works well.




回答2:


I resolved this issue by adding using below attributes in your 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/cfnetwork-internal-error-urlconnectionloader-cpp289

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!