iOS 9 新特性 App Transport Security (ATS)

在iOS 9(xcode7)環境下作網絡圖片下載的請求(http //:),出現如下的問題xcode

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.安全

緣由網絡

iOS9引入了新特性App Transport Security (ATS)。詳情:App Transport Security (ATS)ui

新特性要求App內訪問的網絡必須使用HTTPS協議。加密

可是如今公司的項目使用的是HTTP協議,使用私有加密方式保證數據安全。如今也不能立刻改爲HTTPS協議傳輸。spa

解決辦法:code

  1. 在Info.plist中添加NSAppTransportSecurity類型Dictionary圖片

  2. NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設爲YESit

相關文章
相關標籤/搜索