iOS9https设置info.plist

Xcode 7.0也就是iOS9.0中开发要求App内访问的网络必须使用HTTPS协议。那么我们公司没用采用https怎么办?如果发现网络请求失败,Xcode后台报错信息为: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection. (大概意思就是:资源数据不能被下载,因为APP传输安全策略需要采用安全的连接方式)。

解决方法:

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

    <key>NSAppTransportSecurity</key>
    <dict>
          <key>NSAllowsArbitraryLoads</key>
          <true/>
    </dict>

找到info.plist,注意不是测试文件里面的plist哦。 操作见GIF图。

如图iOS9设置https

posted @ 2017-04-01 00:04  柳刚  阅读(1257)  评论(0编辑  收藏  举报