ios - SFSafariViewController 加载空白白页

标签 ios swift ios10 sfsafariviewcontroller

我正在使用 SFSafariViewController 在我的 iOS 应用程序中打开一个 URL。它在 iOS 9 上运行完美,但在将我的设备更新到 iOS 10 后,它只是加载一个空白页面,地址栏中没有 URL。即使 safariViewController(controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) 在 Controller 出现后也不会被调用。

我已经在 View Controller 中导入了这个:

import SafariServices

代码:

let url = NSURL(string: urlString)!
if #available(iOS 9.0, *) {
    let safariVC = SFSafariViewController(URL: url)
    safariVC.delegate = self
    self.presentViewController(safariVC, animated: true, completion: {
        self.hideHUD()
     })
} else {
    // Fallback code
}

here是指向其他人面临的完全相同问题的链接

最佳答案

尝试注释掉您正在执行的任何加载动画,并尝试不使用它。

...
    // self.showHUD()
    //  self.hideHUD()
...

这是因为 iOS 10 中在安全修复期间引入的一个错误,当使用进度条和加载器作为 window 添加到主 window 上方时,safariViewController 不会加载>

我真希望 Apple 记录了这一变化。 我必须在我当前的应用程序中注释掉加载指示器才能使其正常工作。

关于ios - SFSafariViewController 加载空白白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39662498/

相关文章:

swift - 无法在 bundle 中加载 NIB - swift 3(仅限物理设备)

swift - Core Image 过滤后的图像从 iOS 10 上的 UIImageView 中跳出

ios - 如何检查 iOS 中 SSL 证书的安全性?

ios - 如何检查TextView是否为空?

objective-c - CGrect NSArray 错误

ios - (Swift 3)我需要向用户发送通知以在特定时间打开应用程序。使用本地通知还是推送通知更好?

php - 如何使用 Cordova 和 PHP 后端(在 FireBase 上)实现 Apple Sign In

ios - 我如何证明 ARC 正在运行?

swift - 从 CoreData 刷新 NSTreeController

ios - Swift:单元格 TableviewCell 中的手势不起作用