gpt4 book ai didi

ios - EXC_BAD_ACCESS KERN_INVALID_ADDRESS for WKWebView dealloc

转载 作者:行者123 更新时间:2023-11-29 13:51:36 25 4
gpt4 key购买 nike

为什么下面的堆栈跟踪会因为 WKWebView 而抛出 EXC_BAD_ACCESS KERN_INVALID_ADDRESS?我也不知道这是在哪里发生的。

我不知道这是在哪里发生的,但这是我在我的一个 nib 中对 WKWebView 的引用。

@property (strong, nonatomic) IBOutlet WKWebView *bracketWebView;

堆栈跟踪

Crashed: com.apple.main-thread
0 WebKit 0x2af40854 WebKit::WebPageProxy::close() + 11
1 WebKit 0x2aff496d -[WKWebView dealloc] + 120
2 WebKit 0x2aff496d -[WKWebView dealloc] + 120
3 WebKit 0x2aff48f1 -[WKWebView initWithCoder:] + 20
4 UIKit 0x28bc310f UINibDecoderDecodeObjectForValue + 782
5 UIKit 0x28bc2df5 -[UINibDecoder decodeObjectForKey:] + 296
6 UIKit 0x28aab4a5 -[UIRuntimeConnection initWithCoder:] + 160
7 UIKit 0x28bc310f UINibDecoderDecodeObjectForValue + 782
8 UIKit 0x28bc30a1 UINibDecoderDecodeObjectForValue + 672
9 UIKit 0x28bc2df5 -[UINibDecoder decodeObjectForKey:] + 296
10 UIKit 0x28aaaa0b -[UINib instantiateWithOwner:options:] + 1110
11 UIKit 0x2895daa3 -[UIViewController _loadViewFromNibNamed:bundle:] + 322
12 UIKit 0x28730ffb -[UIViewController loadView] + 142
13 UIKit 0x285f6a1f -[UIViewController loadViewIfRequired] + 150
14 UIKit 0x2860ee71 -[UIViewController __viewWillAppear:] + 124
15 UIKit 0x287a51e5 -[UINavigationController _startCustomTransition:] + 1040
16 UIKit 0x286b34a7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 650
17 UIKit 0x286b31b5 -[UINavigationController __viewWillLayoutSubviews] + 52
18 UIKit 0x286b312b -[UILayoutContainerView layoutSubviews] + 214
19 UIKit 0x285f2a73 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 714
20 QuartzCore 0x2668abcd -[CALayer layoutSublayers] + 128
21 QuartzCore 0x26686375 CA::Layer::layout_if_needed(CA::Transaction*) + 348
22 QuartzCore 0x26686209 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
23 QuartzCore 0x266856d1 CA::Context::commit_transaction(CA::Transaction*) + 368
24 QuartzCore 0x266853a5 CA::Transaction::commit() + 520
25 QuartzCore 0x2667eb2b CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 138
26 CoreFoundation 0x2403d6c9 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
27 CoreFoundation 0x2403b9cd __CFRunLoopDoObservers + 280
28 CoreFoundation 0x2403bdff __CFRunLoopRun + 958
29 CoreFoundation 0x23f8b229 CFRunLoopRunSpecific + 520
30 CoreFoundation 0x23f8b015 CFRunLoopRunInMode + 108
31 GraphicsServices 0x2557bac9 GSEventRunModal + 160
32 UIKit 0x2865f189 UIApplicationMain + 144
33 com.exposure.0 0xbad0d main + 15 (main.m:15)
34 ??? 0x23c33873 (Missing)

最佳答案

您是否在 iOS 11 或更高版本上运行该应用程序?由于 [WKWebView initWithCoder:] 中存在仅在 iOS 11 中修复的错误,导致崩溃。

在 iOS11 之前,我们应该像下面这样创建 WkWebView 的实例:

    let webConfiguration = WKWebViewConfiguration()
webConfiguration.userContentController.add(self, name: "callbackHandler")
wkWebView = WKWebView(frame: contentView.bounds, configuration: webConfiguration)
wkWebView.allowsLinkPreview = false
wkWebView.translatesAutoresizingMaskIntoConstraints = false
wkWebView.navigationDelegate = self
contentView.addSubview(wkWebView)

关于ios - EXC_BAD_ACCESS KERN_INVALID_ADDRESS for WKWebView dealloc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59438919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com