iOS--https 与 http 的问题

question :
sometimes it shows

 "<code class="hljs" livecodeserver="">The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.</code>"

don't worry,it is a problem about iOS $ https,because iOS thought that http is no a security transport. so how can we connect the http?

and how can we solve this problem? it seems easy to do it: close it or use it.
follow:

1:在Info.plist中添加NSAppTransportSecurity类型Dictionary。
2:在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
3:注意,单元测试下面也有一个Info.plist,修改那个文件是没有作用的!

otherwise:

add : 在 info右击=>openAs=>SourceCode 第24行加入

   <key>NSAppTransportSecurity</key>
          <dict>
                 <!--彻底倒退HTTP,允许不安全的信息传送-->
                 <key>NSAllowsArbitraryLoads</key>
                        <true/>
          </dict>

in the product's Info.plist

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 今天很开心❤ 虽然我与你们之前没有太多接触,但人与人之间的真心是感觉的到的,虽然我还没有完全融入,但是今天...
    Adonai华阅读 177评论 0 0
  • 两种方式: 1.使用python对文件操作的方法 2.将命令放在控制台执行(commands模块等) 这里就介绍p...
    我是一只菜鸟呀阅读 1,427评论 0 0
  • 1. 什么是数据库范式?为什么要学习数据库范式? 数据库范式(database normal form):数据库表...
    Zero_devourer阅读 428评论 0 1
  • 一身青衣到底,恰好漏出脚裸的白皙,一个热爱大自然的小女孩躺在芒果树下,伴着芒果花的芳香安静的睡着啦!树上的鸟儿也识...
    73507fd16ab6阅读 1,135评论 0 3
  • 1 她不记得那一年的那一天是为了什么跟周铭吵的架。 她拖着行李叫了一辆摩的到了客运站。 一张白皙的脸气呼呼的,粉色...
    风萧蓝黛阅读 2,427评论 2 3