Swift

使用Xcode7编写iOS9应用时,如果获取http://数据时会报如下错误:
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起,新特性要求App访问网络请求,要采用 HTTPS 协议。

如果仍想要使用HTTP协议,解决办法如下:
1,在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;
2,在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;
原文:Swift - 网络请求报App Transport Security has blocked a cleartext错

原文出自:www.hangge.com  转载请保留原文链接:http://www.hangge.com/blog/cache/detail_822.html
原文地址:https://www.cnblogs.com/Free-Thinker/p/4858350.html