iOS知识---webView加载网址报错Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded beca
2016-06-29 18:26
393 查看
xcode在使用webView加载网页的时候可能会遇到加载不出来的报错问题,
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.
2015-11-20 16:12:16.662 AFNetworking_(3.0)[3091:1742917] failure Error Domain=NSURLErrorDomain Code=-1022 “The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.”
UserInfo={NSUnderlyingError=0x7fedb8e02ef0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 “(null)”}, NSErrorFailingURLStringKey= http://www.baidu.com/ NSErrorFailingURLKey= http://www.baidu.com/ ,
NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
那是因为OS9让所有的HTTP默认使用了HTTPS,原来的HTTP协议传输都改成TLS1.2协议进行传输。直接造成的情况就是App发请求的时候弹出网络无法连接。解决方法,在工程里面的Info.plist里面添加如下节点:
还有种新式该法
App Transport Security Settings Dictionary
Allow Arbitrary Loads Boolean Yes
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.
2015-11-20 16:12:16.662 AFNetworking_(3.0)[3091:1742917] failure Error Domain=NSURLErrorDomain Code=-1022 “The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.”
UserInfo={NSUnderlyingError=0x7fedb8e02ef0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 “(null)”}, NSErrorFailingURLStringKey= http://www.baidu.com/ NSErrorFailingURLKey= http://www.baidu.com/ ,
NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
那是因为OS9让所有的HTTP默认使用了HTTPS,原来的HTTP协议传输都改成TLS1.2协议进行传输。直接造成的情况就是App发请求的时候弹出网络无法连接。解决方法,在工程里面的Info.plist里面添加如下节点:
还有种新式该法
App Transport Security Settings Dictionary
Allow Arbitrary Loads Boolean Yes
相关文章推荐
- Cocos2d 动作使用
- Android随心笔记三:XML布局文件的属性,src与background的简单区别
- IOS开发之Block的使用和内存管理
- Mabatis接口之Mapper接口开发
- android:打造万能通用适配器
- Android下的多线程通信机制
- Android多渠道打包
- Android进阶之自定义View实战(三)贝塞尔曲线应用
- Android 汉字转拼音
- iOS开发讯飞语音的集成
- Android ScrollView中镶嵌GridView
- iOS URL编码和URL解码
- Android属性动画学习笔记(一)
- android开发教程(四)——java之Hello World
- swift 视频合成剪辑——swift学习(十)
- iOS-视频格式转换(MOV->MP4)
- 【iOS开发】如何给字符串添加超连接(响应事件)
- iOS开发技巧之:获取iOS项目名称及版本号
- Android自动更新App
- 学习lambda表达式