升级为iOS9后,默认请求类型为https,如何使用http进行请求会报错?

原因  iOS9引入了新特性App Transport Security (ATS)

新特性要求App内访问的网络必须使用HTTPS协议。

解决方案:在app的info.plist中设置使用http请求

  1. 在Info.plist中添加NSAppTransportSecurity类型Dictionary

  2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

第一步:在plist中添加NSAppTransportSecurity项,此项为NSDictionary

第二步:在NSAppTransportSecurity下添加

NSAllowsArbitraryLoads类型为Boolean,value为YES

iOS9后修改HTTP模式进行网络请求

转载于:https://my.oschina.net/llfk/blog/723957

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2021-04-22
猜你喜欢
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2021-09-26
  • 2021-04-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案