转自 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>