刚学线程通信,提示:

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的更多相关文章

  1. 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

    ios进行http请求,会出现这个问题: App Transport Security has blocked a cleartext HTTP (http://) resource load sin ...

  2. iOS使用webView 加载网页,在模拟器中没有问题,而真机却白屏了。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 f

    还在info.plist中配置.除了配置允许上网的配置之外,还有另一项.

  3. IOS开发 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自7后不再使用http,而是使用https请求,但目前很多网络请求还只是以http请求,我们可以这样解决 info.plist->添加@“App Transport Security ...

  4. Xcode 7中http通信出现如下错误:Application 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 beta1中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据. 解决方法 编辑 info.plist,加入如下设置: <plist> & ...

  5. 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 URL ...

  6. 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 insecur ...

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

    You can easily add it to the plist using the GUI: On the last line add the + Enter the name of the g ...

  8. 报错: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is ins

    环境:Xcode7.1.1 + iOS9.1 详细错误: App Transport Security has blocked a cleartext HTTP (http://) resource ...

  9. 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的解决办法   今天使用Xcod ...

随机推荐

  1. 十分钟让你明白Objective-C的语法(和Java、C++的对比)

    很多想开发iOS,或者正在开发iOS的程序员以前都做过Java或者C++,当第一次看到Objective-C的代码时都会头 疼,Objective-C的代码在语法上和Java, C++有着很大的区别, ...

  2. POJ 3468 A Simple Problem with Integers(线段树区间求和)

    Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. On ...

  3. 计算(a/b)%c

    如果b与c互素,则(a/b)%c=a*b^(phi(c)-1)%c 如果b与c不互素,则(a/b)%c=(a%bc)/b 对于b与c互素和不互素都有(a/b)%c=(a%bc)/b成立

  4. LinQ学习手册

    LinQ : Language Integrated Query(语言集成查询); 1.以统一方式操作各种数据源,减少数据访问的复杂性. 优点在于封装了SQL语句,只对对象进行操作(增删改查),代码量 ...

  5. DictoryInfo.GetFiles

    using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(stri ...

  6. 将 Maven生成的java项目转化为支持 Eclipse IDE的项目

    转自: http://www.xuebuyuan.com/1297046.html 将 Maven生成的java项目转化为支持 Eclipse IDE的项目   在前一篇文章中,我们使用maven创建 ...

  7. Sublime Text 3 无法使用package control安装插件解决办法

    Crossing's Blog NOT Genius but Try Best 首页 分类 关于 归档 标签 问题貌似出现在liveStyle版本更新之后,因为打算安装javascript next和 ...

  8. Daily Sentence

    2016-12-05 08:59:15 Knowing yourself is the beginning of all wisdom. 智者始于自知. 2016-05-01 19:38:25 The ...

  9. ./configure: error: the HTTP rewrite module requires the PCRE library

    docker中CentOS安装nginx出错,提示没有PCRE,需要安装pcre-devel,同时还需要安装openssl.openssl-devel yum -y install pcre-deve ...

  10. linux通过文件查找依赖关系

    通过文件查找安装包安装缺少libstdc++6这个文件在ls /usr/lib/libstd*下有两个文件/usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6 ...