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

运行结果:

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

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

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

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

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

  7. 报错: 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 ...

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

  9. 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> & ...

随机推荐

  1. Android常见控件— — —EditText

    <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...

  2. js 中混乱this

    1.在HTML元素事件属性中inline方式使用this关键字:  <div onclick=" // 可以在里面使用this ">division element&l ...

  3. UIkit框架之UISegmentedControl

    1.继承链:UIcontrol:UIview:uiresponder:NSObject 2.初始化 (1)- (instancetype)initWithItems:(NSArray *)items ...

  4. 收到远程通知,怎么区分是点击通知栏提醒进去的还是在foreground收到的通知?

    我现在是要区分点击通知栏的通知进入应用还是点击应用图标进入的,1,开始程序都是在后台.2,接受通知都是在foreground状态.applicationdidFinishLaunchWithOptio ...

  5. 浅谈SEO-提交(一)

    前段时间,花了点时间研究了下SEO,Search Engine Optimization,百度百科这样描述: 中文意译为“搜索引擎优化”.SEO是指通过对网站内部调整优化及站外优化,使网站满足搜索引擎 ...

  6. NullReferenceException UnityEngine.Transform.get_localPosition

    NullReferenceException  UnityEngine.Transform.get_localPosition unity程序中,需要取得GO自身的Transform,出现如上空异常, ...

  7. ubuntu14 + nginx + php

    ubuntu14 1.安装nginx sudo apt-get install nginx 安装之后的文件结构大致为: * 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/et ...

  8. 格式化用户输入的金额(处理RMB的时候适合)

    number_format($str,'2','.',','); function number($k){ if(strpos($k,'.')===false){ $ok = $k.'; }else{ ...

  9. JavaScript对象属性赋值操作的逻辑

    对象进行属性赋值操作时,其执行逻辑如下所示: 1. 当前对象中是否有该属性?有,进行赋值操作:没有,进行下一步判断. 2. 对象的原型链中是否有该属性?没有,在当前对象上创建该属性,并赋值:有,进行下 ...

  10. ls

    -a, –all 列出目录下的所有文件,包括以 . 开头的隐含文件 -h, –human-readable 以容易理解的格式列出文件大小 (例如 1K 234M 2G) -l 除了文件名之外,还将文件 ...