I have a WKWebView that works in Simulator perfectly but why runs in the device only a white empty screen appear this is my code:
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webConfiguration.preferences.setValue(true, forKey:"allowFileAccessFromFileURLs")
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
let path2Esferas = Path.localPath.stringByAppendingPathComponent(path: "\(Path.DIR_IMAGES)\(ImagenDescargaTipo.esfera.rawValue)/\(desarrollo.id)/virtualtour.html")
let url = URL(fileURLWithPath: path2Esferas)
//NSURL.fileURL(withPath: path2Esferas)
let myRequest = URLRequest(url: url)
webView.load(myRequest)
}
The HTML in "path2Esferas" is in a cache's folder that I load previously, if I put a different URL like let myURL = URL(string: "https://www.apple.com")
as docs show, it works correctly in simulator and device. Eg: http://proyectoshm.com/esferas/real_de_mina/realdeminas.html