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

Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

转载自http://blog.csdn.net/feixiang_song/article/details/47188223

原来代码中的UIWebView网络请求均报错.

今天升级Xcode 7.0 bata发现网络访问失败。

didFailLoadWithError():

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.}

Google后查证,iOS9引入了新特性App Transport Security (ATS)。详情:App Transport Security (ATS)

新特性要求App内访问的网络必须使用HTTPS协议。
但是现在公司的项目使用的是HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS协议传输。

最终找到以下解决办法:

  1. 在Info.plist中添加NSAppTransportSecurity类型Dictionary
  2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

The resource could not be loaded because the App Transport的更多相关文章

  1. Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

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

  2. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.问题解决

    didFailLoadWithError(): Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loa ...

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

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

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

          今天升级Xcode 7.0 bata发现网络访问失败.输出错误信息 The resource could not be loaded because the App Transport S ...

  5. 网络请求出错:The resource could not be loaded because the App Transport

    Google后查证,iOS9引入了新特性App Transport Security (ATS).详情:App Transport Security (ATS) 新特性要求App内访问的网络必须使用H ...

  6. 网络请求报错: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) 如果你想设置不阻止任何网络,只需要在info.plist文 ...

  7. AFNetworking 提示"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection" 解决办法

    原因:iOS9以后,苹果把原http协议改成了https协议,所以不能直接在http协议下GET/POST 解决方案之一: 直接编辑工程文件下的Info.plist文件,加入以下代码 <key& ...

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

    xmpp 项目中遇到的问题,用苹果的通信API 写一个PUT 方法,向服务器上传一张图片.遇到如题问题. Plist 文件没有NSAppTransportSecurity属性 Dic,添加该属性,再添 ...

  9. xcode9.4 报错 error:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

    原因 http | https 协议  不能正常使用 找到的解决方案 但是在字段名上有了变化,不过复制进去 还是会自动选择对应的 解决办法 1. 在Info.plist中添加 App Transpor ...

随机推荐

  1. vim分屏快捷键使用/增大/减小字体使用

    问题描述: vim分屏快捷键使用 问题解决:         (1)vim 分屏快捷键           (2)vim高度改变          (3)vim中增加和减少字体大小  使用快捷键Ctr ...

  2. 【BZOJ】【2194】快速傅里叶之二

    FFT c[k]=sigma a[i]*b[i-k] 这个形式不好搞…… 而我们熟悉的卷积的形式是这样的 c[k]=sigma a[i]*b[k-i]也就是[下标之和是定值] 所以我们将a数组反转一下 ...

  3. pureftpd安装配置-pureftp参数详解(一)

    1. 下载 #cd /usr/local/src/ #wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.30.tar.g ...

  4. Linux 终端访问 FTP 及 上传下载 文件

    今天同事问我一个问题,在Linux 下访问FTP,并将文件上传上去. 我之前一直是用WinSCP工具的. 先将文件从linux copy到windows下,然后在传到ftp上.google 一下. 方 ...

  5. G家二面

    题目都很基本,都属于听说过但是不会做的…都是操作系统,compiler的概念题… 概念题郁闷就郁闷在不会就是不会,就算能扯两句也会被问倒… 算法就一个,pow(x, y),5分钟不到…… 不是听说G家 ...

  6. abs(INT_MAX-(-1))

    写一个程序,结果总是不对,check逻辑好几遍也没发现错误,无奈之下debug.发现一个有趣的现象abs(INT_MAX-(-1))返回值是-2147483648.于是看了下abs函数的代码实现. i ...

  7. 深入浅出ES6(一):ES6是什么

    作者 Jason Orendorff github主页 https://github.com/jorendorff ECMAScript发生了什么变化? 编程语言JavaScript是ECMAScri ...

  8. HTTP 408请求超时错误解决办法

    错误描述 对于大多数网站而言,我们所看到的错误消息已经是开发者定制过的页面,比如我们最常见的自定义404错误页面,一般而言,我们看到的408错误应该是类似这样的提示:“408:Request Time ...

  9. Project Euler 97 :Large non-Mersenne prime 非梅森大素数

    Large non-Mersenne prime The first known prime found to exceed one million digits was discovered in ...

  10. [topcoder]BoxesDiv2

    https://community.topcoder.com/stat?c=problem_statement&pm=13192 #include <vector> #includ ...