首页 > 解决方案 > SFSafariViewController 无法打开本地 html 文件

问题描述

我正在尝试SFSafariViewController使用本地 html 打开,但它会导致崩溃。

let vc = SFSafariViewController(url: URL(fileURLWithPath: Bundle.main.path(forResource: "untitled", ofType: "html")!))
vc.delegate = self

self.present(vc, animated: true)

有没有办法做到这一点?调试时可以看到文件路径。

...../Devices/4980A022-975B-47D3-991B-C9741B06A5FB/data/Containers/Bundle/Application/22BFED43-49B2-4EB9-BAC3-BED26440BA52/xxxx-Internal.app/untitled.html

标签: iosswift

解决方案


推荐阅读