在使用Xcode7时,运行程序会报错,原因如下:
错误描述:
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.
因为在iOS9中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据。
解决方法:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
图解如下:
PS:在info.plist里配置是上图红色圈内的位置,千万不要找错配置文件!
这样配置成功,再次运行,OK了!
参考链接:
全英文的!