Xcode 7 創(chuàng)建新項目用到 UIWebView 發(fā)送請求時昭齐,報下面的錯:
“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”
找查資料后發(fā)現(xiàn)近哟,新特性要求App內訪問網(wǎng)絡請求胎源,要采用 HTTPS 協(xié)議。
但是現(xiàn)在公司的項目使用的是 HTTP 協(xié)議瓜喇,使用私有加密方式保證數(shù)據(jù)安全⊥σ妫現(xiàn)在也不能馬上改成 HTTPS 協(xié)議傳輸。
最終找到以下解決辦法:
1乘寒、在Info.plist中添加 NSAppTransportSecurity 類型 Dictionary ;
2望众、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 類型Boolean ,值設為 YES;