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


目录
相关文章
|
2月前
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
18 1
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
265 0
【错误记录】Tinker 热修复示例运行报错 ( Execution failed for task ‘:app:tinkerProcessD‘ . tinkerId is not set!!! )
|
2月前
|
开发工具
App Store Connect Operation Error ERROR ITMS-90087: “Unsupported Architectures
App Store Connect Operation Error ERROR ITMS-90087: “Unsupported Architectures
27 1
|
2月前
|
Java 数据库 索引
GreenDao,clearIdentityScope报错Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Com
GreenDao,clearIdentityScope报错Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Com
21 1
|
9月前
|
开发者
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
上传苹果版本时错误解决办法:No suitable application records were found. Verify your bundle identifier
74 2
Appium问题解决方案(9)- Original error: Failed to launch Appium Settings app: Condition unmet after 5090 ms
Appium问题解决方案(9)- Original error: Failed to launch Appium Settings app: Condition unmet after 5090 ms
372 0
Appium问题解决方案(9)- Original error: Failed to launch Appium Settings app: Condition unmet after 5090 ms
|
测试技术
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
436 0
Appium问题解决方案(5)- selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy 'name' is not supported for this session
How is note created - backend implementation
Created by Wang, Jerry, last modified on Jan 15, 2015
How is note created - backend implementation
How is note created - SAP backend implementation
How is note created - SAP backend implementation
108 0
How is note created - SAP backend implementation
打包错误--Error:A problem was found with the configuration of task ':app:packageRelease'.
解决办法: app目录下的build.gradle文件 将 shrinkResources 的值改为 false 或者直接去掉   shrinkResources true  表示 :打包的时候会去删除一些不必要 的文件   ------------------------------------- 问题是以往打包一直没出过这样的问题,根本原因不知。
1564 0