刚学线程通信,提示:

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. nagios插件之监控if8接口日志(新接口)

    vi check_if8_log.c #include <stdio.h> #include <stdlib.h> #include <string.h> #inc ...

  2. EK中fromCharCode和parseInt的配合使用

    基于web的漏洞攻击的第一步一般是:在landing page中通过<script>标签下的JavaScript脚本引入一些恶意链接.这些脚本往往会採用各种各样的混淆.加密手法来躲避AV和 ...

  3. ORACLE Recyclebin管理及flashback recyclebin中的对象

    Flashback用于恢复用户误删除的对象(包括表,索引等), 不支持sys用户. system表空间下的对象,也不能从回收站里拿到.故使用SYS 或者SYSTEM用户登陆时, show recycl ...

  4. JS 利用CNZZ进行站长统计

    利用CNZZ对网站进行站长统计 前端页面只需要在body中添加如下代码即可: <script type="text/javascript">var cnzz_proto ...

  5. js在线题目

    在线题目: https://www.nowcoder.com/ta/js-assessment

  6. Android Studio代码自动提示无效

    不生效的原因是因为你AS设置成了省电模式,设置成省电模式了的话,AS会禁掉一些辅助功能,达到省电的目的.所以代码自动提示也被禁掉了. 要修改回来的话,通过File选项,然后倒数第二项:Power Sa ...

  7. Android_使用getIdentifier()获取资源Id

    Android 获取资源ID的另外一种方法,常规获取ID是在特定的文件夹下面的资源,如果在比较特殊的文件夹下面,就需要其他方法获取ID 了: 使用getIdentifier()方法可以方便的获各应用包 ...

  8. php抽象类与接口的区别

    1.对接口的使用是通过关键字implements.对抽象类的使用是通过关键字extends.当然接口也可以通过关键字extends继承. 2.接口中不可以声明成员变量(包括类静态变量),但是可以声明类 ...

  9. MySQL 有输入输出参数的存储过程实例

    1.MySQL 有输入输出参数的存储过程实例 DELIMITER // DROP PROCEDURE IF EXISTS `test`.`p_getvalue` // CREATE PROCEDURE ...

  10. Transfer learning across two sentiment classes using deep learning

    用深度学习的跨情感分类的迁移学习 情感分析主要用于预测人们在自然语言中表达的思想和情感. 摘要部分:two types of sentiment:sentiment polarity and poli ...