升级为iOS9后,默认请求类型为https,如何使用http进行请求会报错?
原因 iOS9引入了新特性App Transport Security (ATS)
新特性要求App内访问的网络必须使用HTTPS协议。
解决方案:在app的info.plist中设置使用http请求
-
在Info.plist中添加
NSAppTransportSecurity类型Dictionary。 -
在
NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
第一步:在plist中添加NSAppTransportSecurity项,此项为NSDictionary
第二步:在NSAppTransportSecurity下添加
NSAllowsArbitraryLoads类型为Boolean,value为YES
转载于:https://my.oschina.net/llfk/blog/723957