我在使用NSURLRequest发起http请求网络资源时,没有成功,终端报了这个问题:
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
这是因为iOS9之后,Apple引入了新特性ATS(App Transparent Security)
就像上面说的,如果使用的Http的方式,需要更改下Info.plist文件。
在现有的逻辑的情况下,解决办法在Info.plist文件中添加新的key和相应的value:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>