关闭

Swift - 网络请求报App Transport Security has blocked a cleartext错

标签: IOS
207人阅读 评论(0) 收藏 举报
分类:


http://www.hangge.com/blog/cache/detail_822.html


使用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;
原文:Swift - 网络请求报App Transport Security has blocked a cleartext错


当然,也可以直接使用Source Code形式打开Info.plist,添加如下配置:
1
2
3
4
5
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

原文出自:www.hangge.com  转载请保留原文链接:http://www.hangge.com/blog/cache/detail_822.html

0
0
查看评论

Xcode 7 App Transport Security has blocked a cleartext HTTP 报错解决办法

Xcode 7 创建新项目用到 UIWebView 发送请求时,报下面的错: “App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary e...
  • elisa1988
  • elisa1988
  • 2015-08-03 18:54
  • 4424

错误:App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insec

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&...
  • itianyi
  • itianyi
  • 2015-11-20 09:59
  • 5923

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.

解决方法: 1.使用https协议请求; 2.Info.plist中增加App Transport Security Settings子项Allow Arbitrary Loads设置为YES。
  • tujiaw
  • tujiaw
  • 2015-11-22 10:12
  • 4071

芒果iOS开发之App Transport Security has blocked a cleartext HTTP (http://) resource load since it is inse

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&...
  • CrazyZhang1990
  • CrazyZhang1990
  • 2015-12-22 23:22
  • 1594

AFNetworking3.xPost请求- “请求对象无法序列化”处理及:App Transport Security has blocked a cleartext HTTP (http://)

问题: 使用AFNetworking 时请求后提示:App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can b...
  • Boyqicheng
  • Boyqicheng
  • 2016-05-12 11:28
  • 624

App Transport Security has blocked a cleartext HTTP(http://) resource load since it is insecure.

使用Xcode 7创建项目,向服务器发送请求时,无法连接服务器,错误信息如下: App Transport Security has blocked a cleartext HTTP(http://) resource load since it is insecure. Temporar...
  • iverain
  • iverain
  • 2017-01-12 11:05
  • 1849

IOSApp Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法

“App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary exceptions can be configured via your app...
  • howlaa
  • howlaa
  • 2016-09-09 16:00
  • 1241

ios9 HTTP网络请求失败 and 第三方sdk 报错问题解决方法

ios9 HTTP网络请求失败 and 第三方sdk 报错问题解决方法
  • u010937022
  • u010937022
  • 2015-10-29 15:31
  • 622

Xcode7网络报错:App Transport Security has blocked a cleartext HTTP

Xcode7网络报错1: Xcode 7 创建新项目用到 UIWebView 发送请求时,报下面的错:  “App Transport Security has blocked a cleartext HTTP (http://) resource load since it is...
  • wenzfcsdn
  • wenzfcsdn
  • 2015-09-19 11:44
  • 1729

AppleWatch真机调试问题:App Transport Security has blocked a cleartext HTTP(http://)resource load since...

今天在进行AppleWatch开发过程中,在进行网络请求时,会报如下错误,网络请求失败:App Transport Security has blocked a cleartext HTTP(http://)resource load since it is insecure .Temporary ...
  • CHENYUFENG1991
  • CHENYUFENG1991
  • 2015-10-11 08:45
  • 2061
    个人资料
    • 访问:128061次
    • 积分:2010
    • 等级:
    • 排名:千里之外
    • 原创:53篇
    • 转载:142篇
    • 译文:4篇
    • 评论:5条
    最新评论