在使用Xcode7,iOS9编译应用时会出现这样的问题,
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
解决方法:
这是iOS9引入了新特性App Transport Security (ATS)
的原因,在App内访问的网络必须使用HTTPS
协议。
- 在Info.plist中添加
NSAppTransportSecurity
类型Dictionary
。 - 在
NSAppTransportSecurity
下添加NSAllowsArbitraryLoads
类型Boolean
,值设为YES