WKWebView跳转闪退
2020-01-03 本文已影响0人
小俊一不小心
项目中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;
}