标签:
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
少年莫慌,这是升级的ios9的https问题,解决起来很简单,关闭他,咱还是用http
1:在Info.plist中添加NSAppTransportSecurity类型Dictionary。
2:在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
3:注意,单元测试下面也有一个Info.plist,修改那个文件是没有作用的!
如果想让有的域名支持https的话也可以这么配置:
补充了配置的方法
对于实在不支持HTTPS的应该首先考虑添加例外
添加例外的方式也很简单:
左键Info.plist选择open with source code
然后添加类似如下的配置:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>qq.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>sina.com.cn</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
根据自己需要的域名修改, NSIncludeSubdomains 顾名思义是包括子域的意思。
标签:
原文地址:http://blog.csdn.net/u013357243/article/details/49964149