您的位置:首页 > 理论基础 > 计算机网络

IOS9之Xcode7允许Http

2015-09-18 14:11 513 查看
转自 http://www.imomi.info/article/Transport%20Security%20has%20Blocked%20a%20cleartext%20HTTP
箱子参考 https://github.com/ChenYilong/iOS9AdaptationTips
HTTP 的。

运行 http 连接程序会提示
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.


本来这是好事儿,但是鉴于特殊国情,还是得支持HTTP啊。

按照提示其实只要在 Info.plist 添加
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>




即可,还可以指定域名。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: