_AssertAutoLayoutOnAllowedThreadsOnly

Hello.

We've been collecting a lot of device feedback crashes, but we've been unable to reproduce them and can't fix them

the Main Thread Checker that opened Xcode has not been able to track the specific location, but there is this crash feedback online every day. At present, I check that all devices with iOS 16.0 system or above appear, and we need the official to help us solve this intractable problem

The stack in the xccrashpoint file does not provide effective stack information, so I cannot locate the specific bug. We have not been able to reproduce the problem using Xcode, so we need your assistance.

I have also seen many people on the forum with similar feedback, but nothing seems to come to fruition

https://developer.apple.com/forums/thread/129686?login=true&page=1#775136022

https://stackoverflow.com/questions/56791779/how-to-track-auto-layout-assertions-from-background-thread

https://forums.developer.apple.com/forums/thread/661349

Launch Time:         2023-09-29 16:55:13.4225 +0800
OS Version:          iPhone OS 16.7 (20H19)
Release Type:        User
Baseband Version:    5.03.01
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001927a4c24
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [5180]

Triggered by Thread:  36

Last Exception Backtrace:
0   CoreFoundation                	0x18b220c44 __exceptionPreprocess + 164 (NSException.m:202)
1   libobjc.A.dylib               	0x1842bfe5c objc_exception_throw + 60 (objc-exception.mm:356)
2   CoreAutoLayout                	0x1a86fde68 _AssertAutoLayoutOnAllowedThreadsOnly + 328 (NSISEngine.m:0)
3   CoreAutoLayout                	0x1a86f4e40 -[NSISEngine withBehaviors:performModifications:] + 36 (NSISEngine.m:1982)
4   UIKitCore                     	0x18d28a3a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1872 (UIView.m:18670)
5   QuartzCore                    	0x18c744ec4 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
6   QuartzCore                    	0x18c758440 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 (CALayer.mm:2519)
7   QuartzCore                    	0x18c76986c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714)
8   QuartzCore                    	0x18c798e3c CA::Transaction::commit() + 648 (CATransactionInternal.mm:432)
9   QuartzCore                    	0x18c7e368c CA::Transaction::release_thread(void*) + 228 (CATransactionInternal.mm:635)
10  libsystem_pthread.dylib       	0x1eb076b9c _pthread_tsd_cleanup + 620 (pthread_tsd.c:416)
11  libsystem_pthread.dylib       	0x1eb079560 _pthread_exit + 84 (pthread.c:1719)
12  libsystem_pthread.dylib       	0x1eb0760cc _pthread_wqthread_exit + 80 (pthread.c:2578)
13  libsystem_pthread.dylib       	0x1eb075e64 _pthread_wqthread + 424 (pthread.c:2612)
14  libsystem_pthread.dylib       	0x1eb075b7c start_wqthread + 8

Thread 0 name:
Thread 0:
0   CoreFoundation                	0x000000018b2259a8 CFStringFindWithOptionsAndLocale + 292 (CFString.c:0)
1   CoreFoundation                	0x000000018b297470 -[__NSCFString hasSuffix:] + 24 (CFObject.m:523)
2   UIKitCore                     	0x000000018d49f48c -[UIKBTree visualStylingForScreenTraits:] + 116 (UIKBTree.m:1240)
3   UIKitCore                     	0x000000018d5f9828 -[UIKBTree visualStyling] + 76 (UIKBTree.m:1349)
4   UIKitCore                     	0x000000018dd9d72c -[UIKeyboardLayoutStar downActionFlagsForKey:] + 360 (UIKeyboardLayoutStar.m:10167)
5   UIKitCore                     	0x000000018dd8a6cc -[UIKeyboardLayoutStar playKeyFeedbackIfNecessaryForTouchDownOnKey:touchInfo:] + 60 (UIKeyboardLayoutStar.m:4972)
6   UIKitCore                     	0x000000018dd942fc -[UIKeyboardLayoutStar touchDownWithKey:withTouchInfo:atPoint:executionContext:] + 2784 (UIKeyboardLayoutStar.m:7916)
7   UIKitCore                     	0x000000018dd9338c -[UIKeyboardLayoutStar completeHitTestForTouchDown:executionContext:] + 1156 (UIKeyboardLayoutStar.m:7620)
8   UIKitCore                     	0x000000018dd92ed8 __51-[UIKeyboardLayoutStar touchDown:executionContext:]_block_invoke_2 + 272 (UIKeyboardLayoutStar.m:7518)
9   UIKitCore                     	0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204)
10  UIKitCore                     	0x000000018dd8ae90 __94-[UIKeyboardLayoutStar performHitTestForTouchInfo:touchStage:executionContextPassingUIKBTree:]_block_invoke + 464 (UIKeyboardLayoutStar.m:5098)
11  UIKitCore                     	0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204)
12  UIKitCore                     	0x000000018de38678 __79-[UIKeyboardImpl performHitTestForTouchEvents:executionContextPassingNSNumber:]_block_invoke_2 + 76 (UIKeyboardImpl.m:11965)
13  UIKitCore                     	0x000000018d65321c -[UIKeyboardTaskEntry execute:] + 208 (UIKeyboardTaskQueue.m:868)
14  UIKitCore                     	0x000000018d653100 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 304 (UIKeyboardTaskQueue.m:446)
15  Foundation                    	0x000000018551074c __NSThreadPerformPerform + 264 (NSThread.m:1046)
16  CoreFoundation                	0x000000018b2ea0cc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
17  CoreFoundation                	0x000000018b2f6758 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
18  CoreFoundation                	0x000000018b27b578 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
19  CoreFoundation                	0x000000018b291064 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
20  CoreFoundation                	0x000000018b29637c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
21  GraphicsServices              	0x00000001c67b835c GSEventRunModal + 164 (GSEvent.c:2196)
22  UIKitCore                     	0x000000018d622f58 -[UIApplication _run] + 888 (UIApplication.m:3782)
23  UIKitCore                     	0x000000018d622bbc UIApplicationMain + 340 (UIApplication.m:5372)
24  libswiftUIKit.dylib           	0x0000000193cb40b0 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:538)
25  SansiroLive                   	0x000000010283cda8 specialized static UIApplicationDelegate.main() + 28 (AppDelegate.swift:17)
26  SansiroLive                   	0x000000010283cda8 static AppDelegate.$main() + 28 (ThirdLoginManager.swift:0)
27  SansiroLive                   	0x000000010283cda8 main + 124
28  dyld                          	0x00000001aa7d4dec start + 2220 (dyldMain.cpp:1165)

The issue was triggered by thread 36, but you didn't post the stack trace of that thread, so it's not possible to know what's going wrong.

In general this means that you triggered layout on a background thread, I would start by looking at any code involved with a UIView or UIViewController, or barring that anything from UIKit that is not marked thread safe. Given your back trace, the issue is also not likely to be temporally "recent" – the code triggering this layout is happening because the thread exited, and some UIView happened to have been marked as needing layout while that thread was active, but Core Animation never got a chance to do the work it was asked to do.

_AssertAutoLayoutOnAllowedThreadsOnly
 
 
Q