错误提示:
The resource could not be loaded because the App Transport Security policy requires …
原因:
iOS9 引入了新特性 App Transport Security (ATS),新特性要求App内访问的网络必须使用HTTPS协议。
若我们使用HTTP协议 进行网络访问,就会提出错误 和连接失败。
解决方法:
- 在 Info.plist 中添加 NSAppTransportSecurity 类型Dictionary。
- 在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean,值设为YES。