tel not open call ios webview swift

 Problem:

I want to open telephone call option ahile add numbers as link in webview.How can i achieve that?


Solution:

public func webView(_ webView: WKWebViewdecidePolicyFor navigationAction: WKNavigationActiondecisionHandler@escaping (WKNavigationActionPolicy) -> Void) {

        if navigationAction.request.url?.scheme == "tel" {

            UIApplication.shared.open(navigationAction.request.url!)

            return decisionHandler(.cancel)

        } else {

            return decisionHandler(WKNavigationActionPolicy.allow);

        }

}


Use the above code to achieve that.While tap on the link it will show you telephone call option.

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift