苹果在IOS9后引入了新特性App Transport Security (ATS),强制网络请求使用HTTPS协议,所以在IOS9使用HTTP协议进行网络请求,会输出一下错误
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
解决办法:
1.在plist.info文件中添加一行名称为:NSAppTransportSecurity 类型为:Dictionary
2.在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
网友评论