iOS报错:The resource could not be loaded because the App Transport Security policy requires

第一次遇到这样的错误,刚开始不知道,一直以为是后台的错误,但后来查了查,发现不是,是iOS 9.0之后引入的一些新特性:App Transport Security (ATS) 链接:https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-DontLinkElementID_13

新特性要求App内访问的网络必须使用HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS协议传输。那么只需要在Info.plist文件中加入App Transport Security Settings,如图:

 

这样就可以了。

原文地址:https://www.cnblogs.com/pengoeng/p/5937566.html