According to our crash analytics, our application crashes while a context menu is opened on a web view. This crash takes place on iOS 26+ only.
The messages states that a web view is no longer inside active window hierarchy, however we doesn't modify web view instance's parent anyhow while the context menu is opened.
Can you please help with a fix or at least workaround for this issue? What's your opinion for bug localization (application or framework)?
NSInternalInconsistencyException UIPreviewTarget requires that the container view is in a window, but it is not. (container: <WKTargetedPreviewContainer: 0x14b442840; name=Context Menu Hint Preview Container>)
userInfo: {
NSAssertFile = "UITargetedPreview.m";
NSAssertLine = 64;
}
Crashed: CrBrowserMain
0 CoreFoundation __exceptionPreprocess + 164
1 libobjc.A.dylib objc_exception_throw + 88
2 Foundation -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0
3 UIKitCore -[UIPreviewTarget initWithContainer:center:transform:] + 660
4 UIKitCore (Missing)
5 UIKitCore (Missing)
6 UIKitCore (Missing)
7 UIKitCore (Missing)
8 UIKitCore (Missing)
9 UIKitCore -[_UIContextMenuPresentation present] + 56
10 UIKitCore +[UIView(UIViewAnimationWithBlocksPrivate) _modifyAnimationsWithPreferredFrameRateRange:updateReason:animations:] + 168
11 UIKitCore (Missing)
12 UIKitCore (Missing)
13 UIKitCore (Missing)
14 UIKitCore (Missing)
15 UIKitCore +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 516
16 UIKitCore (Missing)
17 UIKitCore (Missing)
18 UIKitCore +[UIView __animateUsingSpringWithDampingRatio:response:interactive:initialDampingRatio:initialResponse:dampingRatioSmoothing:responseSmoothing:targetSmoothing:projectionDeceleration:retargetImpulse:animations:completion:] + 192
19 UIKitCore -[_UIRapidClickPresentationAssistant _animateUsingFluidSpringWithType:animations:completion:] + 316
20 UIKitCore -[_UIRapidClickPresentationAssistant _performPresentationAnimationsFromViewController:] + 516
21 UIKitCore -[_UIRapidClickPresentationAssistant presentFromSourcePreview:lifecycleCompletion:] + 400
22 UIKitCore __55-[_UIClickPresentationInteraction _performPresentation]_block_invoke_3 + 48
23 UIKitCore +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 140
24 UIKitCore __55-[_UIClickPresentationInteraction _performPresentation]_block_invoke_2 + 144
25 UIKitCore -[_UIClickPresentationInteraction _performPresentation] + 836
26 UIKitCore postPreviewTransition_block_invoke_2 + 104
27 UIKitCore handleEvent + 256
28 UIKitCore -[_UIClickPresentationInteraction _driverClickedUp] + 48
29 UIKitCore -[_UIClickPresentationInteraction clickDriver:didPerformEvent:] + 400
30 UIKitCore stateMachineSpec_block_invoke_5 + 48
31 UIKitCore handleEvent + 144
32 UIKitCore -[_UILongPressClickInteractionDriver _handleGestureRecognizer:] + 140
33 UIKitCore -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 128
34 UIKitCore _UIGestureRecognizerSendTargetActions + 268
35 UIKitCore _UIGestureRecognizerSendActions + 268
36 UIKitCore -[UIGestureRecognizer _updateGestureForActiveEvents] + 308
37 UIKitCore -[UIGestureRecognizer gestureNode:didUpdatePhase:] + 300
38 Gestures (Missing)
39 Gestures (Missing)
40 Gestures (Missing)
41 Gestures (Missing)
42 UIKitCore -[UIGestureEnvironment _updateForEvent:window:] + 528
43 UIKitCore -[UIWindow sendEvent:] + 2924
44 UIKitCore -[UIApplication sendEvent:] + 396
1
0
57