修改App Transport Security policy requires the use of a secure connection问题

来源:互联网 发布:日本电影知乎 编辑:程序博客网 时间:2024/04/30 12:41

iOS9引入了新特性App Transport Security (ATS)。
新特性要求App内访问的网络必须使用HTTPS协议。
但是很多地方还是HTTP协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS协议传输。
所以会出现HTTP不能正常使用的问题,若不做任何处理,会打印“The resource could not be loaded because the App Transport Security policy requires the use of a secure connection” 错误信息。

解决方法:
进入target的info修改

或者直接在Info.plist中修改即可,在Info.plist中添加App Transport Security Settings字典,然后设置Allow Arbitrary Loads为YES

0 0