Xcode7 beta 网络请求报错 App Transport Security policy
2016-03-01 13:07
323 查看
参考转载自http://blog.csdn.net/feixiang_song/article/details/47188223
网络请求报错 :
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=0x7fce0c9ac400 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of
a secure connection." UserInfo={NSErrorFailingURLStringKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://www.baidu.com/}},
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.}
解决方案:
在Info.plist中添加
在
原因:
Google后查证,iOS9引入了新特性
(ATS)
新特性要求App内访问的网络必须使用
但是现在公司的项目使用的是
网络请求报错 :
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=0x7fce0c9ac400 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of
a secure connection." UserInfo={NSErrorFailingURLStringKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://www.baidu.com/}},
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.}
解决方案:
在Info.plist中添加
NSAppTransportSecurity类型
Dictionary。
在
NSAppTransportSecurity下添加
Allow Arbitrary Loads类型设置为
Boolean, 值设为
YES
原因:
Google后查证,iOS9引入了新特性
App Transport Security (ATS)。详情:App Transport Security
(ATS)
新特性要求App内访问的网络必须使用
HTTPS协议。
但是现在公司的项目使用的是
HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成
HTTPS协议传输。
相关文章推荐
- 为HttpsURLConnection添加信任证书
- Determining IP information for eth0… failed; no link present. eth0虚拟网络无法指定IP
- HttpClient实现客户端与服务器的通信
- Java---Socket编程UDP/TCP
- 易观智库:2015年中国网络视频市场及用户研究
- 使用HttpClient实现文件的上传下载
- nginx限制连接数ngx_http_limit_conn_module模块笔记:二
- linux 网络域名ip查询命令
- 网络知识方面的面试题
- MapServer 之 发布网络覆盖数据服务(WCS-Web Coverage Service)
- android之ConnectivityManager简介,网络连接状态
- 基于nghttp2的APNs new API 测试(c实现)
- iOS 网络处理注意点
- TCP/IP以及socket原理
- Android okhttp完全解析
- No mapping found for HTTP request with URI问题
- vector 扩展的时候http://bbs.csdn.net/topics/260070400
- android下asynchttp库对于session的支持
- Android网络状态实时监听实例代码(二)
- 从copy和mutableCopy谈起(http://www.cocoachina.com/ios/20151202/14520.html)