ios - ATS 设置 NSAllowsArbitraryLoadsInWebContent 不工作

标签 ios uiwebview app-transport-security

我正在尝试让 ATS 设置 NSAllowsArbitraryLoadsInWebContent 在我的 iOS 应用程序中工作,但出于某种原因,该设置似乎被忽略了。我组合了一个快速测试应用程序以确保我的其他 Info.plist 设置都没有破坏,但不安全的链接在 UIWebViews 和 WKWebViews 中仍然被拒绝。以下是我的 Info.plist 文件中的 ATS 设置:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>

这是我在 Controller 中使用 UIWebView 的代码:

  override func viewDidLoad() {
        super.viewDidLoad()
        webView.delegate = self
        let url = URL(string: "https://www.salliemae.com/smartoption/")
        let request = URLRequest(url: url!)
        self.webView.loadRequest(request)
    }

如有任何帮助,我们将不胜感激。

最佳答案

所以看起来这个问题是由于我使用的 Xcode 版本中的一个错误导致的,该错误没有遵守 NSAllowsArbitraryLoadsInWebContent 标志。更新到 Xcode 8.2 beta (8c30a) 解决了这个问题。

关于ios - ATS 设置 NSAllowsArbitraryLoadsInWebContent 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40872637/

相关文章:

ios - 应用程序传输安全问题 iOS9

ios - 在 iOS App 中从 http 切换到 https 会在发布时出现导出合规性问题

iOS 应用程序传输安全性 : possible to disable, 除了域 XY?

iOS 应用程序在手机上崩溃,但在模拟器上运行正常

iphone - 模态视图中的 UIWebview 在横向模式下以纵向显示

ios - 自动布局约束何时解决?

ios - 用于 UIWebView 的 NSURLProtocol 缓慢下载的占位符图像

javascript - 在 UIWebView 中调试 Javascript 有哪些方法?

android - 背景在 iOS 上显示,但在 Android Xamarin 上不显示

ios - iOS 中的 RSS 应用程序 : Detecting the existence of a feed through UIWebView