Xcode organizer crash at: [UIView _backing_traitCollectionDidChange:]

I found one crash in my organizer Crasher report, which happened on over 180 devices for 2 weeks, and it was also caught by the Firebase report, it shows it only crashed on iOS16 and iPhone devices when switching from foreground to background. But I can't replicate this crash locally and the crash stack has no info about my app class, but just some system framework.

Has anyone seen a similar crash? or any suggestion to fix this from Apple dev?

You have a layout loop in GlipUICallButton. Something in GlipUICallButton.configFrame() triggers layout recursively.

462 Glip                          	0x0000000107a05558 GlipUICallButton.layoutSubviews() + 132 (GlipUICallButton.swift:220)
463 Glip                          	0x0000000107a056a0 @objc GlipUICallButton.layoutSubviews() + 28 (:0)
464 UIKitCore                     	0x00000001ab243ef4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920 (UIView.m:18646)
465 QuartzCore                    	0x00000001aa6fe4ac CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
466 UIKitCore                     	0x00000001ab30e468 -[UIView(Hierarchy) layoutBelowIfNeeded] + 296 (UIView.m:13038)
467 UIKitCore                     	0x00000001ab3feb00 -[UIButtonLegacyVisualProvider imageViewCreateIfNeeded:] + 108 (UIButtonLegacyVisualProvider.m:561)
468 UIKitCore                     	0x00000001ab3fea68 -[UIButton imageView] + 36 (UIButton.m:1540)
469 Glip                          	0x0000000107a057b8 GlipUICallButton.configFrame() + 60 (GlipUICallButton.swift:235)
470 Glip                          	0x0000000107a05558 GlipUICallButton.layoutSubviews() + 132 (GlipUICallButton.swift:220)
471 Glip                          	0x0000000107a056a0 @objc GlipUICallButton.layoutSubviews() + 28 (:0)
472 UIKitCore                     	0x00000001ab243ef4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920 (UIView.m:18646)
473 QuartzCore                    	0x00000001aa6fe4ac CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
474 UIKitCore                     	0x00000001ab30e468 -[UIView(Hierarchy) layoutBelowIfNeeded] + 296 (UIView.m:13038)
475 UIKitCore                     	0x00000001ab3feb00 -[UIButtonLegacyVisualProvider imageViewCreateIfNeeded:] + 108 (UIButtonLegacyVisualProvider.m:561)
476 UIKitCore                     	0x00000001ab3fea68 -[UIButton imageView] + 36 (UIButton.m:1540)
477 Glip                          	0x0000000107a057b8 GlipUICallButton.configFrame() + 60 (GlipUICallButton.swift:235)
478 Glip                          	0x0000000107a05558 GlipUICallButton.layoutSubviews() + 132 (GlipUICallButton.swift:220)
479 Glip                          	0x0000000107a056a0 @objc GlipUICallButton.layoutSubviews() + 28 (:0)
480 UIKitCore                     	0x00000001ab243ef4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920 (UIView.m:18646)
481 QuartzCore                    	0x00000001aa6fe4ac CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
482 UIKitCore                     	0x00000001ab30e468 -[UIView(Hierarchy) layoutBelowIfNeeded] + 296 (UIView.m:13038)
483 UIKitCore                     	0x00000001ab3feb00 -[UIButtonLegacyVisualProvider imageViewCreateIfNeeded:] + 108 (UIButtonLegacyVisualProvider.m:561)
484 UIKitCore                     	0x00000001ab3fea68 -[UIButton imageView] + 36 (UIButton.m:1540)
485 Glip                          	0x0000000107a057b8 GlipUICallButton.configFrame() + 60 (GlipUICallButton.swift:235)
486 Glip                          	0x0000000107a05558 GlipUICallButton.layoutSubviews() + 132 (GlipUICallButton.swift:220)
487 Glip                          	0x0000000107a056a0 @objc GlipUICallButton.layoutSubviews() + 28 (:0)
488 UIKitCore                     	0x00000001ab243ef4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1920 (UIView.m:18646)
489 QuartzCore                    	0x00000001aa6fe4ac CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
490 UIKitCore                     	0x00000001ab30e468 -[UIView(Hierarchy) layoutBelowIfNeeded] + 296 (UIView.m:13038)
491 UIKitCore                     	0x00000001ab3feb00 -[UIButtonLegacyVisualProvider imageViewCreateIfNeeded:] + 108 (UIButtonLegacyVisualProvider.m:561)
492 UIKitCore                     	0x00000001ab3fea68 -[UIButton imageView] + 36 (UIButton.m:1540)
493 Glip                          	0x0000000107a057b8 GlipUICallButton.configFrame() + 60 (GlipUICallButton.swift:235)
494 Glip                          	0x0000000107a05558 GlipUICallButton.layoutSubviews() + 132 (GlipUICallButton.swift:220)

@svent Sorry, I upload the wrong crash file. Here is the correct one. Please check.

I am also getting similar crash in iOS 16 and iPhone devices with below stacktrace in Firebase Crashlytics

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x2820 objc_msgSend + 32
1  UIKitCore                      0x9c20f8 -[UIView _backing_traitCollectionDidChange:] + 64
2  UIKitCore                      0x166ba0 -[UIView _traitCollectionDidChangeInternal:] + 652
3  UIKitCore                      0x16689c -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 124
4  UIKitCore                      0x1057d48 __68-[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:]_block_invoke + 216
5  UIKitCore                      0x1056f24 -[UIView _enumerateSubviewsIncludingPrivate:usingBlock:] + 188
6  UIKitCore                      0x1668f4 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 212
7  UIKitCore                      0x90b98 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 96
8  UIKitCore                      0x8f088 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 212
9  UIKitCore                      0x4e04 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1680
10 QuartzCore                     0xa4ac CA::Layer::layout_if_needed(CA::Transaction*) + 500
11 QuartzCore                     0x1da28 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148
12 QuartzCore                     0x2ee54 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444
13 QuartzCore                     0x5e3c0 CA::Transaction::commit() + 648
14 UIKitCore                      0x3bfc90 -[_UISceneLifecycleMultiplexer collectBackingStores] + 32
15 UIKitCore                      0x3bfc50 __35-[UIWindowScene _prepareForSuspend]_block_invoke + 40
16 UIKitCore                      0x2fe004 -[_UIContextBinder purgeContextsWithPurgeAction:afterPurgeAction:] + 388
17 UIKitCore                      0x20befc -[UIWindowScene _prepareForSuspend] + 80
18 UIKitCore                      0x20a578 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 756
19 UIKitCore                      0x20a1cc -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244
20 UIKitCore                      0x20a00c -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 336
21 FrontBoardServices             0x3a04 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 420
22 FrontBoardServices             0x3840 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152
23 FrontBoardServices             0x705c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
24 FrontBoardServices             0x6f78 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 344
25 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
26 libdispatch.dylib              0x791c _dispatch_block_invoke_direct + 264
27 FrontBoardServices             0x11188 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
28 FrontBoardServices             0x10d24 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
29 FrontBoardServices             0x135d0 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
30 CoreFoundation                 0xd3208 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
31 CoreFoundation                 0xdf864 __CFRunLoopDoSource0 + 176
32 CoreFoundation                 0x646c8 __CFRunLoopDoSources0 + 244
33 CoreFoundation                 0x7a1c4 __CFRunLoopRun + 828
34 CoreFoundation                 0x7f4dc CFRunLoopRunSpecific + 612
35 GraphicsServices               0x135c GSEventRunModal + 164
36 UIKitCore                      0x39d37c -[UIApplication _run] + 888
37 UIKitCore                      0x39cfe0 UIApplicationMain + 340
38 FrontPage                      0x9088 main + 18 (AppDelegate.swift:18)
39 ???                            0x1d6b8cdec (Missing)

Hey Apple!

You fixed this in iOS16.5? right?

btw: @revanth Please check your data with iOS16.5.

Xcode organizer crash at: [UIView _backing_traitCollectionDidChange:]
 
 
Q