没有运输安全解决方案? [英] No solution for Transport Security?
问题描述
我尝试了此处的所有方法来解决问题:由于传输安全性不安全,Transport Security阻止了明文HTTP(http://)资源加载.可以通过应用程序的Info.plist文件配置临时异常."
I have tried all the methods of here for solving the problem of: "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."
但是,如果我尝试例如将其添加到我的plist文件中:
But if I try for example adding this in my plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>www.myserver.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>
我收到一个错误:不支持的URL",在这种情况下,我的链接看起来像这样:
I get an error:"Unsupported URL", where in this case my link, looks like this:
let url:NSURL = NSURL(string: "www.myserver.com/jsonsignup.php")
但是如果我要使用:
let url:NSURL = NSURL(string: "http://www.myserver.com/jsonsignup.php")
我将遇到与上述相同的运输安全错误.
I would get the same error of Transport Security as mentioned above.
有帮助吗?
推荐答案
我遇到了同样的问题.我尝试将其添加到info.plist中,但对我也不起作用.所以我尝试了一下,它奏效了.
I had the same issue. I tried adding it to info.plist but it did not work for me either. So I tried this and it worked.
在项目浏览器"中单击您的项目名称,然后单击信息.并将其添加到那里.看到突出显示.
Click on your project name in the "Project Navigator" then click on info. And add it there. See highlighted.
在尝试从项目导航器的支持文件下选择plist之前,由于某种原因,plist无法正常工作.上面的方法应该对您有用.
注意:这将允许所有连接.
Note: This will allow all connections.
这篇关于没有运输安全解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!