今天更新了Xcode 7 正式版,App编译出现不少警告,在App运行的时候出现以下的提示.........html
the resource could not be loaded because the app transport security policy requires the use of a secure connection ios
资源不能被加载,由于该应用程序传输的安全策略要求使用安全链接安全
iOS9引入了新特性App Transport Security (ATS)
。详情:App Transport Security (ATS)网络
新特性要求App内访问的网络必须使用HTTPS
协议。意思是Api接口之后必须是HTTPS
可是如今公司的项目使用的是HTTP
协议,使用私有加密方式保证数据安全。如今也不能立刻改为HTTPS
协议传输。app
暂时解决办法:ui
NSAppTransportSecurity
类型Dictionary
。NSAppTransportSecurity
下添加NSAllowsArbitraryLoads
类型Boolean
,值设为YES