App Transport Security(ATS)
If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn‘t follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app‘s Info.plist file
- 從iOS9開始粥血,所有的http請求應(yīng)該采用
https
,通過TLS 1.2協(xié)議加密薛闪,目的是增強(qiáng)數(shù)據(jù)安全
。如果仍需使用http訪問
,暫時可以在Info.plist中聲明雁歌,使用不安全
的網(wǎng)絡(luò)請求呻引。 - 解決方法:在info.plist中添加以下字段:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>