The resource could not be loaded because the App Transport Security policy requires the use of a sec

来源:互联网 发布:java生成日志文件 编辑:程序博客网 时间:2024/04/27 13:37
Xcode 7 报错: 

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."

这是因为Xcode 7以后,苹果要求所有的网络请求都是安全的(HTTPS).所有如果本身的服务器不支持HTTPS请求的话就要修改Xcode的默认配置.

在info.plist文件中,右击空白位置 Add Row .然后添加类型为Dictionary的NSAppTransportSecurity,在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

0 0
原创粉丝点击