func loadURL(_ request: URLRequest) {
navigationDelegate = self
uiDelegate = self
load(request)
scrollView.delegate = self
}
func loadURL(_ path: String) {
navigationDelegate = self
uiDelegate = self
let url = URL(fileURLWithPath: path)
let data = try! Data(contentsOf: url)
let baseURL = url.deletingLastPathComponent()
load(data, mimeType: "application/pdf", characterEncodingName: "", baseURL: baseURL)
scrollView.delegate = self
}
}
extension ProdWebView: WKNavigationDelegate {
func webView(_ webView: WKWebView,
didStartProvisionalNavigation navigation: WKNavigation!)
{
webViewDelegate?.start()
}
func webView(_ webView: WKWebView,
didFailProvisionalNavigation navigation: WKNavigation!,
withError error: Error)
{
trace?.stop()
webViewDelegate?.error(error)
}
func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation!)
{
trace?.stop()
webViewDelegate?.stop()
}
When user click on The Links double times .... I am getting crash I can see in auto logs code = -999 error
2021-10-03 21:04:43.113096+0530 eTradeMX[22419:6003510] [Process] 0x1070a1818 - [pageProxyID=5, webPageID=6, PID=22420] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -999
But below delegate method is not calling . Some times its calling some Times not calling . I was written delegates also
weak open var navigationDelegate: WKNavigationDelegate?
weak open var uiDelegate: WKUIDelegate?
navigationDelegate = self
uiDelegate = self
func webView(_ webView: WKWebView,
didStartProvisionalNavigation navigation: WKNavigation!)
expect this didStartProvisionalNavigation remaining delegates are calling properly .