http网址无法解析的处理
我们在Xcode中进行解析时,有时候会出现奔溃,检查打印日志显示:
2016-03-21 09:38:02.815 TriS[3385:43012] App Transport Securityhas blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
这是因为iOS 9.0之后不再支持http协议,而支持https(安全的http),此时我们需要解决这个问题,只需要在info.plist中进行处理,便可解决:
1.打开info.plist的源码(Open As -> Source Code),在XML中添加代码:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
2.或者,直接在info.plist中进行添加