Keyframe animation crashes with +[_SwiftUILayerDelegate _screen]: unrecognized selector sent to class on iOS 26

We have an UIViewController called InfoPlayerViewController. Its main subview is from a child view controller backed by SwiftUI via UIHostingController. The InfoPlayerViewController conforms to UIViewControllerTransitioningDelegate. The animation controller for dismissing is DismissPlayerAnimationController. It runs UIKit keyframe animations via UIViewPropertyAnimator. When the keyframe animation is executed there’s an occasional crash for end users in production. It only happens on iOS 26.

FB Radar: FB20871547

An example crash is below.

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: +[_SwiftUILayerDelegate _screen]: unrecognized selector sent to class 0x20c95da08
Termination Reason: SIGNAL 6 Abort trap: 6

Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                	0x1a23828c8 __exceptionPreprocess + 164 (NSException.m:249)
1   libobjc.A.dylib               	0x19f2f97c4 objc_exception_throw + 88 (objc-exception.mm:356)
2   CoreFoundation                	0x1a241e6cc +[NSObject(NSObject) doesNotRecognizeSelector:] + 364 (NSObject.m:158)
3   CoreFoundation                	0x1a22ff4f8 ___forwarding___ + 1472 (NSForwarding.m:3616)
4   CoreFoundation                	0x1a23073a0 _CF_forwarding_prep_0 + 96 (:-1)
5   UIKitCore                     	0x1a948e880 __35-[UIViewKeyframeAnimationState pop]_block_invoke + 300 (UIView.m:2973)
6   CoreFoundation                	0x1a22cb170 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSDictionaryHelpers.m:10)
7   CoreFoundation                	0x1a245d7cc -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 288 (NSDictionaryM.m:271)
8   UIKitCore                     	0x1a948e6bc -[UIViewKeyframeAnimationState pop] + 376 (UIView.m:2955)
9   UIKitCore                     	0x1a7bc40e8 +[UIViewAnimationState popAnimationState] + 60 (UIView.m:1250)
10  UIKitCore                     	0x1a94acc44 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 684 (UIView.m:17669)
11  UIKitCore                     	0x1a94ae334 +[UIView(UIViewKeyframeAnimations) animateKeyframesWithDuration:delay:options:animations:completion:] + 224 (UIView.m:17945)
12  MyApp                       	0x102c78dec static UIView.animateNestedKeyframe(withRelativeStartTime:relativeDuration:animations:) + 208 (UIView+AnimateNestedKeyframe.swift:10)
13  MyApp                       	0x102aef3c0 closure #1 in DismissPlayerAnimationController.slideDownBelowTabBarTransitionAnimator(using:) + 156 (DismissPlayerAnimationController.swift:229)
14  MyApp                       	0x102a2d3d4 <deduplicated_symbol> + 28
15  UIKitCore                     	0x1a7d5ae5c -[UIViewPropertyAnimator _runAnimations] + 172 (UIViewPropertyAnimator.m:2123)
16  UIKitCore                     	0x1a83e1594 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_3 + 92 (UIViewPropertyAnimator.m:3557)
17  UIKitCore                     	0x1a83e1464 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke + 96 (UIViewPropertyAnimator.m:3547)
18  UIKitCore                     	0x1a83e1518 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_2 + 144 (UIViewPropertyAnimator.m:3553)
19  UIKitCore                     	0x1a83e0e64 -[UIViewPropertyAnimator _setupAnimationTracking:] + 100 (UIViewPropertyAnimator.m:3510)
20  UIKitCore                     	0x1a83e1264 -[UIViewPropertyAnimator startAnimationAsPaused:] + 728 (UIViewPropertyAnimator.m:3610)
21  UIKitCore                     	0x1a83de42c -[UIViewPropertyAnimator pauseAnimation] + 68 (UIViewPropertyAnimator.m:2753)
22  UIKitCore                     	0x1a87d5328 -[UIPercentDrivenInteractiveTransition _startInterruptibleTransition:] + 244 (UIViewControllerTransitioning.m:982)
23  UIKitCore                     	0x1a87d5514 -[UIPercentDrivenInteractiveTransition startInteractiveTransition:] + 184 (UIViewControllerTransitioning.m:1012)
24  UIKitCore                     	0x1a7c7931c ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_3 + 152 (UIViewControllerTransitioning.m:1579)
25  UIKitCore                     	0x1a892aefc +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 96 (UIKeyboardSceneDelegate.m:3518)
26  UIKitCore                     	0x1a7c79238 ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_2 + 236 (UIViewControllerTransitioning.m:1571)
27  UIKitCore                     	0x1a94ab4b8 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:animated:] + 188 (UIView.m:17089)
28  UIKitCore                     	0x1a7c79070 _UIViewControllerTransitioningRunCustomTransitionWithRequest + 556 (UIViewControllerTransitioning.m:1560)
29  UIKitCore                     	0x1a86cb7cc __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke_3 + 1784 (UIPresentationController.m:1504)
30  UIKitCore                     	0x1a7c43888 -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:137)
31  UIKitCore                     	0x1a7c437c0 -[_UIAfterCACommitQueue flush] + 168 (_UIAfterCACommitQueue.m:228)
32  UIKitCore                     	0x1a7c436d0 _runAfterCACommitDeferredBlocks + 260 (UIApplication.m:3297)
33  UIKitCore                     	0x1a7c43c34 _cleanUpAfterCAFlushAndRunDeferredBlocks + 80 (UIApplication.m:3275)
34  UIKitCore                     	0x1a7c1f104 _UIApplicationFlushCATransaction + 72 (UIApplication.m:3338)
35  UIKitCore                     	0x1a7c1f024 __setupUpdateSequence_block_invoke_2 + 352 (_UIUpdateScheduler.m:1634)
36  UIKitCore                     	0x1a7c2cee8 _UIUpdateSequenceRunNext + 128 (_UIUpdateSequence.mm:189)
37  UIKitCore                     	0x1a7c2c378 schedulerStepScheduledMainSectionContinue + 60 (_UIUpdateScheduler.m:1185)
38  UpdateCycle                   	0x28c58f5f8 UC::DriverCore::continueProcessing() + 84 (UCDriver.cc:288)
39  CoreFoundation                	0x1a2323230 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:2021)
40  CoreFoundation                	0x1a23231a4 __CFRunLoopDoSource0 + 172 (CFRunLoop.c:2065)
41  CoreFoundation                	0x1a2300c6c __CFRunLoopDoSources0 + 232 (CFRunLoop.c:2102)
42  CoreFoundation                	0x1a22d68b0 __CFRunLoopRun + 820 (CFRunLoop.c:2983)
43  CoreFoundation                	0x1a22d5c44 _CFRunLoopRunSpecificWithOptions + 532 (CFRunLoop.c:3462)
44  GraphicsServices              	0x2416a2498 GSEventRunModal + 120 (GSEvent.c:2049)
45  UIKitCore                     	0x1a7c50ddc -[UIApplication _run] + 792 (UIApplication.m:3899)
46  UIKitCore                     	0x1a7bf5b0c UIApplicationMain + 336 (UIApplication.m:5574)
// ...

Thanks for the bug report, we'll look into it.

Keyframe animation crashes with &#43;[_SwiftUILayerDelegate _screen]: unrecognized selector sent to class on iOS 26
 
 
Q