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

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

The resource could not be loaded because the App Transport Security policy requires the use of a sec_第1张图片

你可能感兴趣的:(X-code)