首页 > 技术文章 > 在Xcode7/7.1中使用Http请求

feijietongti 2015-11-28 16:51 原文

介绍

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

解决办法:

Xcode7

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


NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

*Xcode7.1

在Xcode7.1中苹果更改了这项设定的名称
App Transport Security Settings下添加Allows Arbitrary Loads类型Boolean,值设为YES

推荐阅读