I've found many useful posts on the subject on how openURL is now deprecated in iOS10+. But it took me a while to get it implemented correctly in my project.
This was NOT working for me (using WKWebView), but this is how I had it in my existing code:
- (BOOL)WKWebView:(UIWebView *)WKWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
...code to handle open url...
}
But, this DID work for me (using webView):
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
...code to handle open url...
}
Why is this? My app's target deployment is 8.0 if that matters and I still have code to support the older "openURL" method.
Also, according to documentation, I should be using WKWebView.
For
WKWebView
you should usenavigationDelegate
. AboutshouldStartLoadWithRequest
you can write: