遇到这样的错误
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这种不安全的协议
为什么http不安全, http是超文本传输协议, 信息采用明文传输,
而https则使用SSL加密传输协议进行传输.
既然服务器的链接并不是我们前端所能决定的,
如果一定要发送http协议的请求, 可以修改当前项目的Info.plist文件来实现:
方式一: 使用文本编辑info.plist, 在当中添加:
<key>NSAppTransportSecurity</key>
<dict>
<key>
NSAllowsArbitraryLoads</key>
<true/>
</dict>
方式二: 在Info.plist中添加: