无法下载图片 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

刚学线程通信,提示:

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.

原来是因为 iOS9之后,原http协议被改成了https协议,使用 TLS1.2 SSL加密请求数据。

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

即可

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^{
        NSLog(@"url:%@",[NSThread currentThread]);
        NSURL *url = [NSURL URLWithString:@"http://www.cechina.cn/upload/article/adc81d83-4603-4e1c-a116-9325e89cd309/s1.jpg"];
        NSData *data = [NSData dataWithContentsOfURL:url];
        UIImage *image = [UIImage imageWithData:data];
        NSLog(@"url:%@,image:%@",[NSThread currentThread],image);

dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"downLoad:%@,image:%@",[NSThread currentThread],image);

[self.btn setBackgroundImage:image  forState:UIControlStateNormal];
        });
    });
    
}

无法下载图片 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

时间: 2024-10-29 19:08:12

无法下载图片 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&#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’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.-解决办法

运行环境: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]; re

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 协议. 但是我获取的