iOS xcode 网络请求报错:The resource could not be loaded because the App Transport Security policy requires

今天用了一下UIWebView控件,loadRequest后报错:

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.


Google后查证,iOS9引入了新特性App Transport Security (ATS)。详情:App Transport Security (ATS)

新特性要求App内访问的网络必须使用HTTPS协议。

 最终找到以下解决办法:

  1. 在Info.plist中添加NSAppTransportSecurity类型Dictionary
  2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES



文章转自: http://blog.csdn.net/feixiang_song/article/details/47188223

你可能感兴趣的:(iOS xcode 网络请求报错:The resource could not be loaded because the App Transport Security policy requires)