美文网首页
iOS9 新特性ATS

iOS9 新特性ATS

作者: Onego | 来源:发表于2016-06-15 19:55 被阅读25次

XCode7 新建的项目,要求使用HTTPS协议

HTTP+SSL/TLS+TCP = HTTPS

也就是说,服务需要提供HTTPS(TLS 1.2)的接口;

如果服务不改变,则需要在info.plist中加入下面的键值,用来信任所有HTTP服务器

<key>NSAllowsArbitraryLoads</key>

<true/>

<key>NSAppTransportSecurity</key>

<dict>

<!--Connect to anything (this is probably BAD)-->

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict>

或者严谨的

<key>NSAppTransportSecurity</key>

<dict>

<key>NSExceptionDomains</key>

<dict>

<!--Include to allow subdomains-->

<key>NSIncludesSubdomains</key>

<true/>

<!--Include to allow insecure HTTP requests-->

<key>NSTemporaryExceptionAllowsInsecureHTTPLoads<key>

<true/>

<!--Include to specify minimum TLS version-->

<key>NSTemporaryExceptionMinimumTLSVersion</key>

<string>TLSv1.1</string>

</dict>

</dict>

</dict>

相关文章

网友评论

      本文标题:iOS9 新特性ATS

      本文链接:https://www.haomeiwen.com/subject/sydpdttx.html