When you click the call button, you need to return decisionHandler(WKNavigationActionPolicyAllow) in this -(void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction )navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandlerproxy method ); Then in the proxy method - (void)webView:(WKWebView )webView didStartProvisionalNavigation:(WKNavigation )navigation Judge [webView.URL absoluteString]
Paste the code:
//If you do not implement this proxy method, urls such as phone calls will be blocked by default -(void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction )navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
When you click the call button, you need to return
decisionHandler(WKNavigationActionPolicyAllow) in this
-(void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction )navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandlerproxy method );
Then in the proxy method - (void)webView:(WKWebView )webView didStartProvisionalNavigation:(WKNavigation )navigation
Judge [webView.URL absoluteString]
Paste the code:
//If you do not implement this proxy method, urls such as phone calls will be blocked by default
-(void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction )navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
}
(void)webView:(WKWebView )webView didStartProvisionalNavigation:(WKNavigation )navigation
{
if ([newPath hasPrefix:@"sms:"] || [newPath hasPrefix:@"tel:"]) {
}
}
tel://xxx?
Excuse me, has this problem been solved? I also encountered the same problem
Is it because of the Chinese colon used?
Similar to
<a href="tel:xxx">xxx</a>
, there will be no problem.Try this
Colon: Chinese is used:)
-(void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction )navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
In this method, print the value of navigationAction.navigationType. If it is 0, special treatment is required