iOS网络中http协议无法使用的解决方案

更新Xcode7以后运行模拟器,控制台打印:Application 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 Transport Security (ATS)。详情:App Transport Security (ATS)

新特性要求App内访问的网络必须使用HTTPS协议

解决办法如下:在info.plist里添加如下字段:

NSAppTransportSecurity Dictionary

NSAllowsArbitraryLoads Boolean

你可能感兴趣的:(iOS网络中http协议无法使用的解决方案)