如何将NSAppTransportSecurity添加到我的info.plist文件中? [英] How can I add NSAppTransportSecurity to my info.plist file?
问题描述
https://developer.apple.com/videos/wwdc/2015 /?id = 711 @ 5:55
我似乎无法将此添加到我的info.plist中。没有价值。我正在运行XCode版本7.0 beta(7A121l),并在iOS9上进行测试。
I can't seem to be able to add this to my info.plist. There is no value it. I'm running XCode Version 7.0 beta (7A121l), and testing on iOS9.
因为我无法明确声明我想要的视频中的URL,我继续获取App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全。临时例外可以通过您的应用程序的Info.plist文件配置错误。
Because I can't specifically declare what URL's I want as seen in the video, I keep getting "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" errors.
但是,我似乎无法配置它。有什么想法吗?
However, I don't seem to be able to configure it. Any ideas?
推荐答案
试试这个---在Xcode-beta 4 7.0中为我工作
try With this --- worked for me in Xcode-beta 4 7.0
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.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>
还有一个选项,如果你想禁用ATS,你可以使用它:
Also one more option, if you want to disable ATS you can use this :
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
但不建议这样做。服务器应该具有SSL证书,因此没有隐私泄露。
But this is not recommended at all. The server should have the SSL certificates and so that there is no privacy leaks.
这篇关于如何将NSAppTransportSecurity添加到我的info.plist文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!