刚学线程通信,提示:

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. android笔记1——开发环境的搭建

    Long Long ago...已经成为了历史,我还是要说出一个真相:早年前,那时候,android还不被大众所认知的时候,当然开发人员也没不像如今那样趋于饱和状态.一位大牛前辈,也是我的学长,那时候 ...

  2. openfire研究之部署连接管理器(connection manager)

    http://blog.sina.com.cn/s/blog_7325f5150101bafh.html 一. Openfire Connection Manager 简介 Openfire Conn ...

  3. 网络视频传输的服务质量(QoS)

    QoS(Qualityof Service)服务质量,是网络的一种安全机制, 是用来解决网络延迟和阻塞等问题的一种技术.在正常情况下,如果网络只用于特定的无时间限制的应用系统,并不需要QoS,比如We ...

  4. CSS Transform让百分比宽高布局元素水平垂直居中

    很早以前了解过当元素是固定宽度和高度的时候,水平垂直高居中的方法可以设置margin的负值来使其居中,这个负值是元素的宽和高的一半,比如宽高是100px,那么就用margin-left:-50px;m ...

  5. MatLab实现FFT与功率谱

    FFT和功率谱估计 用Fourier变换求取信号的功率谱---周期图法 clf; Fs=1000; N=256;Nfft=256;%数据的长度和FFT所用的数据长度 n=0:N-1;t=n/Fs;%采 ...

  6. linq to sql简单使用

    1.新建一个winform项目. 2.添加一个Linq to Sql 类,命名为Northwind 3.打开服务器资源管理器,将表拖动到linq to sql 类,实体类就由Vs生成了 4.实例化Da ...

  7. Mvc4.0添加商品到Cookie

    /// <summary> /// 添加Cookie /// </summary> /// <param name="gc">GoodsToCo ...

  8. EditText默认不显示光标,不可编辑,点击它,进入编辑状态,光标显示

    设置EditText不可编辑,光标不可见: et.setCursorVisible(false); 设置EditText可编辑,光标可见: et.setOnClickListener(new OnCl ...

  9. JQuery————基础&&基础选择器

    环境搭建 搭建一个jQuery的开发环境非常方便,可以通过下列几个步骤进行. 下载jQuery文件库 在jQuery的官方网站(http://jquery.com)中,下载最新版本的jQuery文件库 ...

  10. ASP.NET后台自定义导出Excel

    关于导出,属于老生常谈了,下面就总结下我自己遇到的一些导出吧. 1.使用Excel组件进行导出(需要安装Microsoft Office Excel). 下面为代码,希望可以帮助别人. 1)准备数据源 ...