0
任何人都可以解釋如何加載本地html文件到WKWebView?Swift3:如何從文檔目錄加載html文件到WKWebview
我用下面的代碼試圖行之有效的模擬器,但不是在設備
let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
let documentDirectoryPath: String = path[0]
let fileManager = FileManager()
let destinationURLForFile = URL(fileURLWithPath: documentDirectoryPath + "/" + "\(NameF.fileName)/\(NameF.Languages)/page_\(i + 1).html")
print("D2\(destinationURLForFile)")
let request = NSURLRequest(url: destinationURLForFile)
webView!.load(request as URLRequest)
任何建議將是有益的!
'fileManager'的用途是什麼?什麼是'NameF'? – Astoria
設備上有任何錯誤? – Neha
尋找這個答案您的問題http://stackoverflow.com/a/26202983/5251783 – Hosny