iOS 12.4.4:加载URL后无法从设备加载本地HTML页面

时间:2020-02-26 08:24:35

标签: swift wkwebview

我正在从WKWebView中的本地设备HTML页面加载https://google.com。我使用以下代码加载HTML页面。

let folderURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
let diectory1 = "Contents/" + self.BookDirectory + "/" + file
let htmlPath = folderURL.appendingPathComponent(diectory1).path
let folderPath = folderURL.path
let baseUrl = URL(fileURLWithPath: folderPath, isDirectory: true)
let htmlURL = URL(fileURLWithPath: htmlPath, isDirectory: false)
wkWebView.loadFileURL(htmlURL, allowingReadAccessTo: folderURL)

再次加载本地html后出现此错误

ProvisionalPageProxy::didFailProvisionalLoadForFrame: pageID = 1, frameID = 1, navigationID = 2

wkwebview一直显示https://google.com

0 个答案:

没有答案
相关问题