UITrackingElementWindowController crash when viewDidDisappear on iPadOS26.1

hello, I have been receiving crash reports on iPadOS 26.1, When UITrackingElementWindowController viewDidDisappear

The feedback associated with this post is: FB20986398 and Exception

Exception

'Cannot remove an observer <PKTextEffectsWindowObserver 0x10854cbe0> for the key path "frame" from <UITextEffectsWindow 0x10827ca00> because it is not registered as an observer.'


#1	0x0000000183529814 in objc_exception_throw ()
#2	0x00000001845065a4 in -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] ()
#3	0x00000001845069c8 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] ()
#4	0x00000001845068e0 in -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] ()
#5	0x00000001cb22e894 in -[PKTextEffectsWindowObserver dealloc] ()
#6	0x000000018beafb28 in _setInteractionView ()
#7	0x000000018d81e8b8 in -[UIView(Dragging) removeInteraction:] ()
#8	0x00000001cb216448 in -[PKTextInputInteraction willMoveToView:] ()
#9	0x000000018beafb1c in _setInteractionView ()
#10	0x000000018d81e8b8 in -[UIView(Dragging) removeInteraction:] ()
#11	0x000000018d5ab094 in -[UIEditingOverlayViewController _removeInteractions] ()
#12	0x000000018cb166a8 in -[UIViewController _setViewAppearState:isAnimating:] ()
#13	0x000000018cb16d70 in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 ()
#14	0x000000018cb16c10 in __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke ()
#15	0x000000018655ef78 in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ ()
#16	0x00000001866b4a24 in -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] ()
#17	0x000000018cb16a44 in -[UIViewController _setViewAppearState:isAnimating:] ()
#18	0x000000018cb1753c in -[UIViewController __viewDidDisappear:] ()
#19	0x000000018cb17638 in -[UIViewController _endAppearanceTransition:] ()
#20	0x000000018ca2401c in __48-[UIPresentationController transitionDidFinish:]_block_invoke ()
#21	0x000000018ca23cd0 in -[UIPresentationController transitionDidFinish:] ()
#22	0x000000018ca2d720 in -[_UICurrentContextPresentationController transitionDidFinish:] ()
#23	0x000000018ca27608 in __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke.106 ()
#24	0x000000018cb31fec in -[_UIViewControllerTransitionContext completeTransition:] ()
#25	0x000000018d7f09bc in -[UITransitionView notifyDidCompleteTransition:] ()
#26	0x000000018d7f0750 in -[UITransitionView _didCompleteTransition:] ()
#27	0x000000018bf1c2a4 in __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ ()
#28	0x000000018d817960 in -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] ()
#29	0x000000018d7f7168 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] ()
#30	0x000000018d7f75cc in -[UIViewAnimationState animationDidStop:finished:] ()
#31	0x000000018d7f763c in -[UIViewAnimationState animationDidStop:finished:] ()
#32	0x0000000186fedda4 in run_animation_callbacks ()
#33	0x000000010365e2d0 in _dispatch_client_callout ()
#34	0x000000010367f4c0 in _dispatch_main_queue_drain.cold.5 ()
#35	0x0000000103654778 in _dispatch_main_queue_drain ()
#36	0x00000001036546b4 in _dispatch_main_queue_callback_4CF ()
#37	0x00000001865b42c8 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#38	0x0000000186567b3c in __CFRunLoopRun ()
#39	0x0000000186566a6c in _CFRunLoopRunSpecificWithOptions ()
#40	0x0000000226ee5498 in GSEventRunModal ()
#41	0x000000018bf2aba4 in -[UIApplication _run] ()
#42	0x000000018bed3a78 in UIApplicationMain ()

Could you update the feedback report and add the steps to reproduce the issue. Also you had the following code snippet :

 UIWindow *window = UIApplication.sharedApplication.windows.lastObject;

First, you should use the window scene instead. Also, this isn’t a recommended way to get the active window. There’s no guarantee that any given window you find is actually visible to the user at any given time, even if it’s active.

If you need to present a UI, use a UI object, such as a UIViewController, as an anchor for that UI.

UITrackingElementWindowController crash when viewDidDisappear on iPadOS26.1
 
 
Q