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

运行环境:Xcode Version 7.3.1 (7D1014)

使用NSURL进行数据请求数据代码:

-(NSData *)requestData{
    NSURL *url = [NSURL URLWithString:@"http://easyread.ph.126.net/seRpubnsz_WwJGz7fexyeg==/7696583593456123398.jpg"];
    NSData *data = [NSData dataWithContentsOfURL:url];
    return data;
}

报错: 

2016-07-04 17:11:44.325 testMultiThread[2904:173072] 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.

原因:Xcode版本的新特性要求App内访问网络请求,要采用 HTTPS 协议。

但是现在公司的项目使用的是 HTTP 协议,使用私有加密方式保证数据安全。现在也不能马上改成 HTTPS 协议传输。

最终找到以下解决办法:

1、在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;

在info.plist中添加
<key>NSAppTransportSecurity</key>
<dict>
   <key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

2、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;

运行结果:

时间: 2024-10-19 15:29:01

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.-解决办法的相关文章

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&#39;s Info.plist file

ios进行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 解决办法:在工程文件*.plist中进行配置,截图如下: 用记事本打开工程文件,为: <key>NSAppTranspo

无法下载图片 App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&#39;s Info.plist file

刚学线程通信,提示: 2016-01-27 11:11:02.246 20-9 gcd3 communicationOfThread[5193:298643] 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. 原

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

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 找查资料后发现,新特性要求App内访问网络请求,要采用 HTTPS 协议. 但是现在公司的项目使用的是 HTTP 协议,使用私有加密方式保证数据安全.现在也不能马上

IOS开发系列(6)App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&#39;s Info.plist file.

在学习网络处理的过程,发现代码都没错,运行时却发生以下警告: 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. 问题分析: 应用程序采取了明文HTTP协议(http:/ /).而在iOS9 中,苹果引入了一项隐私

IOS开发 App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app&#39;s Info.plist file.

xcode自7后不再使用http,而是使用https请求,但目前很多网络请求还只是以http请求,我们可以这样解决 info.plist->添加@“App Transport Security Settings”字段->添加“Allow Arbitrary Loads”字段,并将对应的value值设置为@“YES” IOS开发 App Transport Security has blocked a cleartext HTTP (http://) resource load since it

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.

App Transport Security has blocked a cleartext HTTP (http://) resource load

"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" // 报错,按照要求设置了之后,还是报这个错误.(快疯了) 删除了 info.plist 中的配置重新写了一遍,好了(真TMD神奇) 配置: 如果是H

Xcode 7提示App Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法

Xcode 7提示App Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法 今天使用Xcode 7打开用Xcode 6开发的网络请求项目,Xcode 7 控制台提示如下: App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary except

Xcode 7遇到 App Transport Security has blocked a cleartext HTTP 错误

今天用Xcode 7 创建新项目用到 URL 发送请求时,报下面的错: “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” 找查资料后发现,新特性要求App内访问网络请求,要采用 HTTPS 协议. 但是我获取的