App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure

来源:互联网 发布:寻路算法有哪些 编辑:程序博客网 时间:2024/04/29 03:59

    错误描述

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


      在iOS9中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据,所以会出现上述错误。

      解决方法:

   1、找到 info.plist文件,注意不要找错了Test里面的。

   

  

  2.在info.plist的空白处点击鼠标右键,选取下图的“Show Raw Keys/Values”


  

  3.进入下图界面

  

  

  4.把鼠标移到Information Property List上面,会出现一个 “+” ,点击 “+” 会出现红色框处的选择栏。

  


  5.滑动上图选择栏,选取“NSAppTransportSecurity”。

  

  

  6.如下图,点击左侧“▶️”符号,使该箭头如下图,指向下方,在点击“+”,出现如下选择栏,选择 “NSAllowsArbitraryLoads”。

  


  7.如下图,点击黑色圆圈处,出现下拉框,选择“YES”。

   


 8.最后设置图如下。

  

     



  

1 0
原创粉丝点击