Cordova ios 升级到WKWebview后程序需要进入到
2019-12-26 本文已影响0人
Baffin
这个问题主要是由于WKWebView没有对“gap”进行拦截,对比UIWebview的插件后,在
- (void)webView: (WKWebView*) webViewdecidePolicyForNavigationAction: (WKNavigationAction*) navigationActiondecisionHandler: (void(^)(WKNavigationActionPolicy)) decisionHandler
中加入拦截既可。
if ([[url scheme] isEqualToString:@"gap"]) {
[vc.commandQueue fetchCommandsFromJs];
// The delegate is called asynchronously in this case, so we don't have to us
// flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes.
[vc.commandQueueexecutePending];
}
后续Cordova方表示会跟随ios弃用UIWebview,还是拭目以待吧!目前只好用cordova-plugin-wkwebview-engine插件了!
官方说明blog:https://ionicframework.com/blog/understanding-itms-90809-uiwebview-api-deprecation