请求网络发现报错:
[The resource could not be loaded because the App Transport Security policy requires the use of a secure connection]
后面发现是
iOS9引入了新特性App Transport Security (ATS)
。详情:App Transport Security (ATS)
新特性要求App内访问的网络必须使用HTTPS
协议。但是现在公司的项目使用的是HTTP
协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS
协议传输。
解决的办法:
最终找到以下解决办法:
在Info.plist中添加AppTransportSecurity类型Dictionary。
在AppTransportSecurity下添加 Allows Arbitrary Loads类型Boolean,值设为YES
添加完成后,再次运行,就可以看到请求结果啦~~~
参考文章:
https://segmentfault.com/a/1190000002933776
觉得文章有用,请用支付宝扫描,领取一下红包!打赏一下
支付宝红包码
网友评论