美文网首页04『 网络相关 』
iOS开发 - 9.0+ https协议问题

iOS开发 - 9.0+ https协议问题

作者: Li_Cheng | 来源:发表于2016-06-27 17:14 被阅读0次
    引言:

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

    解决办法:
    1. 通过配置Info.plist文件:
      Info.plist中添加NSAppTransportSecurity类型为:Dictionary。
      NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型为Boolean,值设为YES。

    2. 通过代码解决:
      将Info.plist文件 Source Code 打开, 输入下面代码:

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

    GitHub: https://github.com/LiCheng244/LCUtils
    个人博客: http://www.licheng244.com/


    相关文章

      网友评论

        本文标题:iOS开发 - 9.0+ https协议问题

        本文链接:https://www.haomeiwen.com/subject/xawzdttx.html