I'm migrating an iOS app form UIWebView to WKWebView. So far so good... In the previous app I disabled long press and implemented a custom long press (to do custom handling of links), however I can't get this working in the WKWebView
I've tried the following:
- (void)webView:(WKWebView *)wkWebView didFinishNavigation:(WKNavigation *)navigation {
[wkWebView evaluateJavaScript:@"document.body.style.webkitTouchCallout='none';" completionHandler:nil];
}
I've checked and that line gets executed, the response of the call is @"None"
But it responds with: Warning: Attempt to present on whose view is not in the window hierarchy!
Any ideas? SOLUTION: Inject javascript into wkwebview now works!
[self.wkWebView evaluateJavaScript:@"document.body.style.webkitTouchCallout='none';" completionHandler:nil];