We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OC 方法 -(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { NSURL *url = navigationAction.request.URL; if ([url.scheme isEqualToString:@"weixin"] || [url.scheme isEqualToString:@"alipay"]) { if ( [[UIApplication sharedApplication] canOpenURL:url]) { if (@available(iOS 10.0, *)) { [[UIApplication sharedApplication] openURL:url options:@{UIApplicationOpenURLOptionUniversalLinksOnly: @no} completionHandler:nil]; } else { [[UIApplication sharedApplication] openURL:url]; } decisionHandler(WKNavigationActionPolicyCancel); return; } } decisionHandler(WKNavigationActionPolicyAllow); }
脚本如下 defineClass("LYWebViewController", { webView_decidePolicyForNavigationAction_decisionHandler: function (webView, navigationAction,decisionHandler) { var url = navigationAction.request().URL(); if (url.scheme().isEqualToString("weixin") || url.scheme().isEqualToString("alipay")) { if (UIApplication.sharedApplication().canOpenURL(url)) { if (UIDevice.currentDevice().systemVersion().floatValue() >= 10) { UIApplication.sharedApplication().openURL_options_completionHandler(url, { UIApplicationOpenURLOptionUniversalLinksOnly: NO }, null); } else { UIApplication.sharedApplication().openURL(url); } decisionHandler(0); return; } } decisionHandler(1); } }, {});
ios 11 正常执行,ios 11.3 脚本报错,说decisionHandler不是函数,是个object
The text was updated successfully, but these errors were encountered:
我也遇到了相同的问题 请问解决了吗
Sorry, something went wrong.
试试
if (typeof decisionHandler == 'function') { decisionHandler(0); } if (typeof decisionHandler == 'function') { decisionHandler(1); }
No branches or pull requests
OC 方法
-(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
NSURL *url = navigationAction.request.URL;
if ([url.scheme isEqualToString:@"weixin"] || [url.scheme isEqualToString:@"alipay"]) {
if ( [[UIApplication sharedApplication] canOpenURL:url]) {
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:url options:@{UIApplicationOpenURLOptionUniversalLinksOnly: @no} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:url];
}
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
}
decisionHandler(WKNavigationActionPolicyAllow);
}
脚本如下
defineClass("LYWebViewController", {
webView_decidePolicyForNavigationAction_decisionHandler: function (webView, navigationAction,decisionHandler) {
var url = navigationAction.request().URL();
if (url.scheme().isEqualToString("weixin") || url.scheme().isEqualToString("alipay")) {
if (UIApplication.sharedApplication().canOpenURL(url)) {
if (UIDevice.currentDevice().systemVersion().floatValue() >= 10) {
UIApplication.sharedApplication().openURL_options_completionHandler(url, {
UIApplicationOpenURLOptionUniversalLinksOnly: NO
}, null);
} else {
UIApplication.sharedApplication().openURL(url);
}
decisionHandler(0);
return;
}
}
decisionHandler(1);
}
}, {});
ios 11 正常执行,ios 11.3 脚本报错,说decisionHandler不是函数,是个object
The text was updated successfully, but these errors were encountered: