美文网首页
iOS--https 与 http 的问题

iOS--https 与 http 的问题

作者: 追风筝的荧火虫 | 来源:发表于2017-07-27 16:37 被阅读82次

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

相关文章

  • iOS--https 与 http 的问题

    question :sometimes it shows don't worry,it is a problem ...

  • iOS--https的配置

    https(全称:Hyper Text Transfer Protocol over Secure Socket ...

  • 网络

    一、HTTP协议相关问题 二、TCP 与 UDP 相关问题 三、DNS 相关问题 四、Session 与 Cook...

  • 网站http与https同时访问

    问题: 网站一直用http,最近增加了https,要求http与https同时正常访问。 http页面引用http...

  • http 问题汇总

    1 编码问题 对于一般的请求,请求参数一定要放到请求的body里, 并且请求参数要符合json:{"query":...

  • HTTP相关问题

    一. 什么是HTTP HTTP协议工作在应用层,端口号是80。HTTP协议被用于网络中两台计算机间的通信,相比于T...

  • HTTP缓存问题

    在客户端第一次请求数据时,此时缓存数据库中没有对应的缓存数据,需要请求服务器,服务器返回后,将数据存储至缓存数据库...

  • HTTP缓存问题

    介绍 平时我去学习Http应用层协议的时候,对于Http的结构和请求头字段的作用方面掌握了一些知识点,但是没有系统...

  • iOS http 问题

    好记性不如烂笔头。 iOS9引入了新特性App Transport Security (ATS)。解决方法: 在I...

  • HTTP系列问题

    http协议是什么?有哪些特点? 常见Http方法有哪些?使用场景分别是什么? GET与POST有什么区别? 在H...

网友评论

      本文标题:iOS--https 与 http 的问题

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