今天更新了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