您的位置:首页 > 理论基础 > 计算机网络

Xcode7 网络请求报错:The resource could not be loaded because the App Transport Security policy...

2016-03-06 23:53 363 查看
今天在学习IOS的WebView控件时发现WebView加载URL报错,菜鸟的我只能上Google一查究竟。

错误信息:

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.


最后网上查到在IOS9的时候引入了App
Transport Security (ATS)。

详细文档参考:https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-DontLinkElementID_13



解决办法:

第一步:在Info.plist中添加NSAppTransportSecurity类型Dictionary。

第二步:在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值为YES。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: