I have a WKWebView that loads a webpage with some telephone links on the webpage.
Currently i have this code to handle clicks to those links.
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if navigationAction.request.url?.scheme == "tel" {
if #available(iOS 10.0, *) {
UIApplication.shared.open(navigationAction.request.url!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(navigationAction.request.url!)
}
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
This works fine on any device with ios 10 installed, i am prompted with an alert box asking to either cancel or make a call. but on ios 9 devices the telephone app screen flashes (no prompt) and it nothing happens after.