天天看點

xcode7建立的工程預設情況下不能使用http通路網絡

運作時會出現如下的提示資訊

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

這是由于iOS9 以後蘋果引入了App Transport Security (ATS)新特性,新特性要求App内通路的網絡必須使用HTTPS協定。

但是現在公司的項目使用的是HTTP協定,使用私有加密方式保證資料安全。現在也不能馬上改成HTTPS協定傳輸。

解決方案如下:

在Info.plist中添加NSAppTransportSecurity類型Dictionary。 在NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean, 值設為YES

截圖如下![效果圖](https://img-blog.csdn.net/20160303162552194)