問題描述:
升級Xcode 7.0發現網絡訪問失敗。
輸出錯誤信息
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),新特性要求App內訪問的網絡必須使用HTTPS協議。但是現在公司的項目使用的是HTTP協議,使用私有加密方式保證數據安全。現在也不能馬上改成HTTPS協議傳輸。最終找到以下解決辦法:
在Info.plist中添加NSAppTransportSecurity類型Dictionary。
在NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設為YES(如下圖)
20160225144254249.png