标题:
iOS WKWebView 禁止拨打电话的bug
[打印本页]
作者:
look_w
时间:
2019-3-8 19:00
标题:
iOS WKWebView 禁止拨打电话的bug
WKWebView 的bug还真多
// 处理拨打电话以及Url跳转等等
- (void)webView
WKWebView *)webView decidePolicyForNavigationAction
WKNavigationAction *)navigationAction decisionHandler
void (^)(WKNavigationActionPolicy))decisionHandler {
NSURL *URL = navigationAction.request.URL;
NSString *scheme = [URL scheme];
if ([scheme isEqualToString
"tel"]) {
NSString *resourceSpecifier = [URL resourceSpecifier];
NSString *callPhone = [NSString stringWithFormat
"telprompt://%@", resourceSpecifier];
/// 防止iOS 10及其之后,拨打电话系统弹出框延迟出现
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
});
}
decisionHandler(WKNavigationActionPolicyAllow);
}
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0