今天在学习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。
在使用Xcode7进行iOS应用开发时,遇到WebView加载URL因App Transport Security(ATS)策略导致的错误。ATS是iOS9引入的安全特性,限制了HTTP连接。解决方法是在Info.plist文件中添加NSAppTransportSecurity字典,并设置NSAllowsArbitraryLoads为YES,允许不安全的网络请求。
3040

被折叠的 条评论
为什么被折叠?



