NSExceptionAllowsInsecureHTTPLoads不适用于IP地址 [英] NSExceptionAllowsInsecureHTTPLoads not working for IP addresses
问题描述
排除iOS 9上的ATS对我不起作用。
excluding ATS on iOS 9 doesn't work for me.
我有一个没有域名(仅限IP地址)且没有SSL证书的测试服务器(所以它是HTTP而不是HTTPS)
I have a test server which has no domain name (IP address only) and no SSL certificate (so it is HTTP and not HTTPS)
尝试:
<key>52.24.145.252</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
但我仍然收到错误:
App 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.
我做错了什么?
推荐答案
您需要将 NSAppTransportSecurity
字典添加到 info.plist
。然后将
NSAllowsArbitraryLoads
键添加到该字典,并将布尔值设置为 YES
。
You need to add NSAppTransportSecurity
dictionary to your info.plist
. Then add
NSAllowsArbitraryLoads
key to that dictionary and set the boolean value to YES
.
更新
从2017年1月开始,如果您使用上述方法退出ATS,您需要在向AppStore提交应用程序时向Apple提供理由。
From 2017 January, if you are using the above mentioned method for opting-out from ATS you need to provide a justification to Apple while submitting your app to AppStore.
这篇关于NSExceptionAllowsInsecureHTTPLoads不适用于IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!