Swift - 网络请求报App Transport Security has blocked a clear
发布时间:2020-12-14 06:21:39 所属栏目:百科 来源:网络整理
导读:使用Xcode7编写iOS9应用时,如果获取http://数据时会报如下错误: 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. 原因:
使用Xcode7编写iOS9应用时,如果获取http://数据时会报如下错误:
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.
原因: 从iOS9起,新特性要求App访问网络请求,要采用 HTTPS 协议。 如果仍想要使用HTTP协议,解决办法如下: 1,在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ; 2,在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean,值设为 YES;
原文出自: www.hangge.com 转载请保留原文链接: http://www.hangge.com/blog/cache/detail_822.html (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |