xcode7的网络请求问题 http

 

 

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

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

 最终找到以下解决办法:

xcode7

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

       

      xcode7.1

    3. 昨天刚刚升级了XCode 7.1,然后在使用MPMoviePlayerController 播放在线流视频的时候报了HTTP的错误,如下:

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

      提示很明显,修改 Info.plist 文件即可,修改如下:


      搞定。

posted on 2015-11-18 22:51  孤城雨  阅读(245)  评论(0编辑  收藏  举报