ATS 的三种解决方法

来源:互联网 发布:关于费米估算法的书 编辑:程序博客网 时间:2024/05/19 20:00

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之前是没有的,苹果从iOS9之后认为http协议是不安全的,所以默认是不允许加载http协议的,默认是https

所以需要在Info.plist中需要配置一下。


当你遇到上述错误时有三种解决方法

1、使用https

2、用如下方式打开Info.plist

App <wbr>Transport <wbr>Security <wbr>has <wbr>blocked <wbr>a <wbr>cleartext <wbr>HTTP <wbr>(http://) <wbr>resource <wbr>load <wbr>since <wbr>it <wbr>is <wbr>insecur

复制下面代码直接粘贴到文件中,如下所示

代码:

NSAppTransportSecurity

   

        NSAllowsArbitraryLoads

       

 

   

App <wbr>Transport <wbr>Security <wbr>has <wbr>blocked <wbr>a <wbr>cleartext <wbr>HTTP <wbr>(http://) <wbr>resource <wbr>load <wbr>since <wbr>it <wbr>is <wbr>insecur

3、在Info.plist中配置如下图所示App <wbr>Transport <wbr>Security <wbr>has <wbr>blocked <wbr>a <wbr>cleartext <wbr>HTTP <wbr>(http://) <wbr>resource <wbr>load <wbr>since <wbr>it <wbr>is <wbr>insecur


0 0
原创粉丝点击