iOS9 出現 the resource could not be loaded because the app transport security policy requires the use

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

  1. 在Info.plist中添加NSAppTransportSecurity類型Dictionary
  2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設爲YES
相關文章
相關標籤/搜索