iOS xcode 7网络请求错误failure Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded

在升级到Xcode 7.0后,项目中的网络请求遇到错误,提示资源加载失败,原因是App Transport Security (ATS) 强制要求使用HTTPS。为了解决这个问题,可以在项目的Info.plist文件中配置ATS例外,允许不安全的HTTP请求,或者设置'Allow Arbitrary Loads'为YES,使得应用能够成功发送网络请求。
摘要由CSDN通过智能技术生成

在我们使用(xocde7.0)打开以前的项目时,发现之前的项目在原来的版本上都没有问题,在xcode7.0上网络请求部分发生了错误,会看到有这么一段东西输出在控制台(据说7.1没那问题);

2015-11-20 16:12:16.569 AFNetworking_(3.0)[3091:1743943] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.
2015-11-20 16:12:16.662 AFNetworking_(3.0)[3091:1742917] failure Error Domain=NSURLErrorDomain Code=-1022 “The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.” UserInfo={NSUnderlyingError=0x7fedb8e02ef0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 “(null)”}, NSErrorFailingURLStringKey=http://comment.api.163.com/api/json/post/list/new/hot/ent2_bbs/AI1O4EEK00032DGD/0/10/10/2/2, NSErrorFailingURLKey=

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值