用AFNetworking请求时,报错,具体如下:
Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."
意思是:资源不能被加载,因为该应用程序传输的安全策略要求使用安全连接
新特性要求App内访问的网络必须使用HTTPS协议。意思是Api接口以后必须是HTTPS
但是我以前的项目使用的是HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS协议传输。
解决办法:
在Info.plist中添加App Transport Security Settings类型Dictionary。
在App Transport Security Settings下添加Allow Arbitrary Loads类型Boolean,值设为YES