didFailLoadWithError():

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7fce0c9ac400 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://www.baidu.com/}}, NSErrorFailingURLStringKey=http://www.baidu.com/, NSErrorFailingURLKey=http://www.baidu.com/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

Google后查证,iOS9引入了新特性App Transport Security (ATS)。详情:App Transport Security (ATS)

新特性要求App内访问的网络必须使用HTTPS协议。
但是现在公司的项目使用的是HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS协议传输。

最终找到以下解决办法:

    1. 在Info.plist中添加NSAppTransportSecurity类型Dictionary
    2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.问题解决的更多相关文章

  1. Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

    Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Xcode7 beta 网络请求报错:The ...

  2. 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

    iOS9引入了新特性App Transport Security (ATS).详情:App Transport Security (ATS) 如果你想设置不阻止任何网络,只需要在info.plist文 ...

  3. AFNetworking 提示"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection" 解决办法

    原因:iOS9以后,苹果把原http协议改成了https协议,所以不能直接在http协议下GET/POST 解决方案之一: 直接编辑工程文件下的Info.plist文件,加入以下代码 <key& ...

  4. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

    xmpp 项目中遇到的问题,用苹果的通信API 写一个PUT 方法,向服务器上传一张图片.遇到如题问题. Plist 文件没有NSAppTransportSecurity属性 Dic,添加该属性,再添 ...

  5. xcode9.4 报错 error:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

    原因 http | https 协议  不能正常使用 找到的解决方案 但是在字段名上有了变化,不过复制进去 还是会自动选择对应的 解决办法 1. 在Info.plist中添加 App Transpor ...

  6. IOS9网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

    今天下载Xcode7试了下,运行项目时报上面的错误,网上查了下原来iOS9引入了新特性App Transport Security (ATS).详情:App Transport Security (A ...

  7. Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requir

          今天升级Xcode 7.0 bata发现网络访问失败.输出错误信息 The resource could not be loaded because the App Transport S ...

  8. The resource could not be loaded because the App Transport

    Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Xcode7 beta 网络请求报错:The ...

  9. Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport

    Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Xcode7 beta 网络请求报错:The ...

随机推荐

  1. oc-14-对象方法调用类方法

    Person.h #import <Foundation/Foundation.h> @interface Person : NSObject { @public int _age; fl ...

  2. java中静态的代码块,静态变量,静态方法

    简单了解一下java虚拟机--jvm几个内存区域: 方法区:在java的虚拟机中有一块专门用来存放已经加载的类信息.常量.静态变量以及方法代码的内存区域, 常量池:常量池是方法区的一部分,主要用来存放 ...

  3. 检测MYSQL不同步发邮件通知的脚本

    脚本代码如下:#!/bin/bash                                                                                   ...

  4. JS概念

    1.This(当前方法属于谁,this就属于谁) http://www.cnblogs.com/yanhaijing/p/3685309.html#undefined

  5. LeetCode5 Longest Palindromic Substring

    题意: Given a string S, find the longest palindromic substring in S. You may assume that the maximum l ...

  6. docker-hub 账户

    Docker Hub和docker及其组件一起工作.Docker Hub会帮助你和你的同事协作,并获取功能最全的docker.要做到这一点,它提供的服务有: Docker镜像主机 用户认证 自动镜像构 ...

  7. 爬虫入门scrapy

    Python之路[第十九篇]:爬虫   网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本.另外一些不常使用 ...

  8. MVC框架 - 捆绑

    捆绑和缩小是两个性能改进提高应用程序在请求负载时的技术.目前大多数的主流浏览器限制每个主机同时连接到六个数量.这意味着,在一个时间,所有的其他请求将被浏览器排队. 启用捆绑和缩小 为使捆绑和缩小MVC ...

  9. 巧用FileShare解决C#读写文件时文件正由另一进程使用的bug

    在使用C#进行文件读写的时候,一旦对文件操作频繁,总会碰到一些令人措手不及的意外.例如经常会碰到的一个问题: System.IO.IOException: 文件“XXX”正由另一进程使用,因此该进程无 ...

  10. 自动备份并保存最近几天的SQL数据库作业脚本

    DECLARE @filename VARCHAR(255) DECLARE @date DATETIME SELECT @date=GETDATE() SELECT @filename = 'G:\ ...