Returned WKWebView was not created with the given configuration问题修复

简介: 调用WKWebView的时候,有些页面会打开新的一页,导致WKWebView出现闪退日志

问题

调用WKWebView的时候,有些页面会打开新的一页,导致WKWebView出现闪退日志:

2020-05-14 21:36:51.793103+0800 GDNXBankProject[6797:3353899] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Returned WKWebView was not created with the given configuration.'

解决问题

在原来的WebView进行读取新的页面,代码:

#pragma mark - WKUIDelegate
// 创建一个新的WebView
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures{
    //修复'Returned WKWebView was not created with the given configuration.'问题
    if (!navigationAction.targetFrame.isMainFrame) {
      [webView loadRequest:navigationAction.request];
    }
    return nil;
}


目录
相关文章
|
8月前
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
58 1
|
8月前
|
Android开发
【Bug】Android resource linking failed和error: failed linking references.
【Bug】Android resource linking failed和error: failed linking references.
shiro学习之错误 No realms have been configured! One or more realms must be present to execute an authori
shiro学习之错误 No realms have been configured! One or more realms must be present to execute an authori
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
317 0
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
|
5月前
|
Dart 开发工具
解决升级Flutter3.0后出现警告Operand of null-aware operation ‘!‘ has type ‘WidgetsBinding‘ which excludes null
解决升级Flutter3.0后出现警告Operand of null-aware operation ‘!‘ has type ‘WidgetsBinding‘ which excludes null
59 1
|
8月前
【Bug】ERROR ResizeObserver loop completed with undelivered notifications.
【Bug】ERROR ResizeObserver loop completed with undelivered notifications.
|
开发者
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
129 2
|
JavaScript Java Spring
【异常】This application has no explicit mapping for /error, so you are seeing this as a fallback的解决方法
This application has no explicit mapping for /error, so you are seeing this as a fallback的解决方法
4984 0
【异常】This application has no explicit mapping for /error, so you are seeing this as a fallback的解决方法
|
Android开发
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
清单文件合并失败Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4
Manifest merger failed with multiple errors, see logs
Manifest merger failed with multiple errors, see logs
136 0