iOS WebView加載URL 報錯:Code=-1022

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."安全

這是由於Xcode 7之後,蘋果要求全部的網絡請求都是安全的(HTTPS).全部若是自己的服務器不支持HTTPS請求的話就要修改Xcode的默認配置.服務器

在info.plist文件中,添加類型爲Dictionary的NSAppTransportSecurity,在NSAppTransportSecurity下添加Boolean類型的NSAllowsArbitraryLoads,值設爲YES網絡

相關文章
相關標籤/搜索