在Xcode7/7.1中使用Http请求

介绍

iOS9引入了新特性App Transport Security (ATS)。
新特性要求App内访问的网络必须使用HTTPS协议。
但是现在很多项目使用的是HTTP协议,现在也不能马上改成HTTPS协议传输。
那么如何设置才能在iOS9中使用Http请求呢

解决办法:

Xcode7

Info.plist中add Row添加NSAppTransportSecurity类型Dictionary

《在Xcode7/7.1中使用Http请求》
NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

*Xcode7.1

在Xcode7.1中苹果更改了这项设定的名称
App Transport Security Settings下添加Allows Arbitrary Loads类型Boolean,值设为YES
《在Xcode7/7.1中使用Http请求》

    原文作者:Hydrogen
    原文地址: https://segmentfault.com/a/1190000003852877
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞