短暂性解决http网络请求安全的问题(iOS的坑)

xiaoxiao2021-02-28  137

xcode报错,“App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file”

1.xcode7出来的时候。就有了https,使用加密方式保证数据安全。但是公司使用的还是HTTP协议。

刚开始的时候,使用info.plist,添加

NSAppTransportSecurity  为   Dictionary型, 再往字典里添加NSAllowsArbitraryLoads为Boolean型,再设置  YES就好。

现在不能用了。只能右键打开info.plist"使用“Open as” “soure code"的方式,添加这代码

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict>

或添加

App Transport Security Settings为Dictionary型, 再往字典里添加NSAllowsArbitraryLoads为Boolean型,再设置  YES就好

添加方式一样,字段有一点不一样。

转载请注明原文地址: https://www.6miu.com/read-26485.html

最新回复(0)