ios 传输安全阻止了明文 HTTP (XCode 8)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42500047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 08:56:44  来源:igfitidea点击:

Transport security has blocked a cleartext HTTP (XCode 8)

iosswiftxcodeswift3xcode8

提问by Mimi

I'm trying to write a Swift app that pulls the RSS feed from a blog and displays it onto the screen. There's an error: 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.

我正在尝试编写一个 Swift 应用程序,该应用程序从博客中提取 RSS 提要并将其显示在屏幕上。出现错误:App Transport Security 已阻止明文 HTTP (http://) 资源加载,因为它不安全。可以通过应用程序的 Info.plist 文件配置临时异常。

How do I configure the one blog's website Info.plist to be an exception? There is no NSAllowsArbitraryLoads option in the drop-down menu.

如何将一个博客的网站Info.plist配置为例外?下拉菜单中没有 NSAllowsArbitraryLoads 选项。

回答by javimuu

Add to your Info.plistfile:

添加到您的Info.plist文件:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>