编写了一个简单的Demo,其中一个界面中WebView控件需要进行网络连接,但程序运行时出错:
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.
//App Transport Security 阻止了不安全的HTTP资源加载。可以通过配置您应用程序的Info.plist文件解决。
解决方法1:
用文本编辑器打开程序Info.plist文件,向其中加入以下内容:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
解决方法2:
用Xcode打开Info.plist文件进行设置: