iOS iOS9下修改回HTTP模式进行网络请求

升级为iOS9后,默认请求类型为https,如何使用http进行请求会报错

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

方案一:让服务器修改为TLS1.2

 

方案二:在plist中设置使用http请求

第一步:在plist中添加NSAppTransportSecurity项,此项为NSDictionary

第二步:在NSAppTransportSecurity下添加

NSAllowsArbitraryLoads类型为Boolean,value为YES

 

posted @ 2015-09-17 14:40  pretty guy  阅读(399)  评论(0编辑  收藏  举报