在Xcode7 中iOS9引入了新特性App Transport Security (ATS)壶辜。詳情:
App Transport Security (ATS)
在App運(yùn)行的時(shí)候出現(xiàn)如下的提示:
the resource could not be loaded because the app transport security policy requires the use of a secure connection
意思是:資源不能被加載橘忱,因?yàn)樵搼?yīng)用程序傳輸?shù)陌踩呗砸笫褂冒踩B接
新特性要求App內(nèi)訪問的網(wǎng)絡(luò)必須使用HTTPS協(xié)議注盈。意思是Api接口以后必須是HTTPS
但是我以前的項(xiàng)目使用的是HTTP協(xié)議,使用私有加密方式保證數(shù)據(jù)安全∮├Γ現(xiàn)在也不能馬上改成HTTPS協(xié)議傳輸谷羞。
解決辦法:
在Info.plist中添加NSAppTransportSecurity類型Dictionary。
在NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設(shè)為YES