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;
}


目录
相关文章
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
322 0
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
Flutter之运行提示Could not update files on device: Connection closed before full header was received
Flutter之运行提示Could not update files on device: Connection closed before full header was received
788 0
|
5月前
|
JSON Android开发 数据格式
Android c++ core guideline checker 应用问题之JSON compilation database的定义如何解决
Android c++ core guideline checker 应用问题之JSON compilation database的定义如何解决
|
6月前
|
Web App开发 JavaScript
vue报错【解决方案】 [Violation] Added non-passive event listener to a scroll-blocking <some> event.
vue报错【解决方案】 [Violation] Added non-passive event listener to a scroll-blocking <some> event.
798 0
|
8月前
【Bug】ERROR ResizeObserver loop completed with undelivered notifications.
【Bug】ERROR ResizeObserver loop completed with undelivered notifications.
|
8月前
ORA-00600 [kwqitnmphe:ltbagi] Errors even after the fix for Bug 17831758 and Bug 18536720 is in place (Doc ID 2002540.1)
ORA-00600 [kwqitnmphe:ltbagi] Errors even after the fix for Bug 17831758 and Bug 18536720 is in place (Doc ID 2002540.1)
55 4
|
开发者
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
134 2
BeanFactory not initialized or already closed - call 'refresh' before access
BeanFactory not initialized or already closed - call 'refresh' before access
368 0
|
应用服务中间件 Android开发
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
148 0
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
|
开发工具
Flutter ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
Flutter ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
311 0

热门文章

最新文章