项目中iOS wkwebview 跳转打开新网页时遇到崩溃的问题。
解决方法
原因- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures{
if (navigationAction.request.URL) {
WKWebView *wkWebView = [[WKWebView alloc] initWithFrame:webView.frame configuration:configuration];
wkWebView.UIDelegate = self;
wkWebView.navigationDelegate = self;
[webView loadRequest:navigationAction.request];
return wkWebView;
}
return nil;
}
网友评论