Xcode7 (IOS9) 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

更新了下Xcode,运行之前的项目发现提示网络不可用,在模拟器里用浏览器访问相应地址,是可以打开的;

Xcode7 (IOS9) 报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

记得听到过IOS9要求App内访问的网络必须使用HTTPS协议,百度到以下解决方法:

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

添加后问题解决

Snip20150919_2

 

未经允许不得转载:ganlei的个人博客 » Xcode7 (IOS9) 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

赞 (4)
分享到:更多 ()