iOS - CoreAutoLayout [NSISEngine withAutomaticOptimizationDisabled:] 崩溃

问题描述 投票:0回答:1

我目前遇到 Firebase 报告的生产崩溃,指出某些自动布局工作正在后台线程上完成。虽然修复显然是将有问题的代码包装在调度主块上,但我们找不到任何指向该代码的内容。

这种情况似乎特别难以重现 - 我们无法在开发中重现它。

崩溃似乎发生在启动期间/启动后,并且每个用户的情况略有不同,这可能意味着一些异步工作会根据差异触发它。我检查了堆栈跟踪提供的所有线程,但找不到任何有意义的内容。

这是 Firebase 提供的堆栈跟踪 - 绝对没有提及触发该更新的应用代码。想知道是否有人有一些见解。

Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.

崩溃的线程

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9270c __exceptionPreprocess
1  libobjc.A.dylib                0x14f04 objc_exception_throw
2  CoreAutoLayout                 0x5000 -[NSISEngine withAutomaticOptimizationDisabled:]
3  CoreAutoLayout                 0x9e00 -[NSISEngine _optimizeWithoutRebuilding]
4  CoreAutoLayout                 0xbd2c -[NSISEngine optimize]
5  CoreAutoLayout                 0x49b4 -[NSISEngine performPendingChangeNotifications]
6  UIKitCore                      0x3331a0 -[UIView(Hierarchy) layoutSubviews]
7  UIKitCore                      0x17c738 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8  QuartzCore                     0x3cedc CA::Layer::layout_if_needed(CA::Transaction*)
9  QuartzCore                     0x2fc90 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
10 QuartzCore                     0x4367c CA::Context::commit_transaction(CA::Transaction*, double, double*)
11 QuartzCore                     0x4c164 CA::Transaction::commit()
12 QuartzCore                     0x9fa08 CA::Transaction::release_thread(void*)
13 libsystem_pthread.dylib        0x3da0 _pthread_tsd_cleanup
14 libsystem_pthread.dylib        0x6c18 _pthread_exit
15 libsystem_pthread.dylib        0x225c pthread_main_np
16 libsystem_pthread.dylib        0x1e98 _pthread_wqthread
17 libsystem_pthread.dylib        0x193c start_wqthread

主线程追踪

com.apple.main-thread
0  libsystem_kernel.dylib         0x14e0 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1b24 mach_msg + 76
2  CoreFoundation                 0x7820 __CFRunLoopServiceMachPort + 372
3  CoreFoundation                 0xbcac __CFRunLoopRun + 1180
4  CoreFoundation                 0x1f6b8 CFRunLoopRunSpecific + 600
5  GraphicsServices               0x1374 GSEventRunModal + 164
6  UIKitCore                      0x513e88 -[UIApplication _run] + 1100
7  UIKitCore                      0x2955ec UIApplicationMain + 364
8  MyApp                          0x671c main + 20 (main.swift:20)
9  ???                            0x102689ce4 (Missing)
ios swift multithreading crash autolayout
1个回答
0
投票

我在iOS16上也有同样的问题。终于解决了?

© www.soinside.com 2019 - 2024. All rights reserved.