NSInternalInconsistencyException crash in iOS 17

Hey Team,

We started to get the NSInternalInconsistencyException crash only for iOS 17. The crash logs are very generic and don’t point to any specific screen or code that’s why it's hard to figure out the root cause for this. We already tried running the main thread checker but we didn’t get any thread issues.

Kindly help.

Crash Logs:

Fatal Exception: NSInternalInconsistencyException

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

0  CoreFoundation                 0xec870 __exceptionPreprocess
1  libobjc.A.dylib                0x2bc00 objc_exception_throw
2  CoreAutoLayout                 0x56c8 NSISSparseVectorAddTermWithPlaceValueCoefficientStartingIndex
3  CoreAutoLayout                 0xbadc -[NSISEngine _optimizeWithoutRebuilding]
4  CoreAutoLayout                 0xb7f0 -[NSISEngine optimize]
5  CoreAutoLayout                 0xb57c -[NSISEngine performPendingChangeNotifications]
6  UIKitCore                      0x33f38 -[UIView(Hierarchy) layoutSubviews]
7  UIKitCore                      0x32694 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8  QuartzCore                     0x671c0 CA::Layer::layout_if_needed(CA::Transaction*)
9  QuartzCore                     0x66d48 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
10 QuartzCore                     0x6d278 CA::Context::commit_transaction(CA::Transaction*, double, double*)
11 QuartzCore                     0x66574 CA::Transaction::commit()
12 QuartzCore                     0x1fe504 CA::Transaction::release_thread(void*)
13 libsystem_pthread.dylib        0x9f48 _pthread_tsd_cleanup
14 libsystem_pthread.dylib        0x4880 _pthread_exit
15 libsystem_pthread.dylib        0x5d7c _pthread_wqthread_legacy_worker_wrap
16 libsystem_pthread.dylib        0x19ec _pthread_wqthread
17 libsystem_pthread.dylib        0x1a04 start_wqthread

The crash logs are very generic and don’t point to any specific screen or code

Please post a full Apple crash report. See Posting a Crash Report for advice on how to do that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Full Crash logs

I have been dealing with errors like this for quite sometime. The only solution I have been to able find is using crashlytics to track when and where this happened. Then I use instruments with the Swiftui profile. Then I optimize and get rid of code that was not written to the documentation's specs. After that crashes improve. With that said it would be really nice if the stack trace told you what line of your code caused the problem.

Having same issue here. This crash has been ramping up and becoming more frequent over the past year but I am unable to reproduce it. The stack trace gives me no clue where in my code we are accessing layout off the main thread. Enabling "Main Thread Checker" does nothing (it was already enabled anyway). Would appreciate any advice for how to track this down.

Any solutions?

Also having same issue. From Crashlytics stack trace there is no clue what's going on before crash. Need help

Same issue as well. It has been last at least 4 months but i still can not fix it. Thanks for people who can help that.

Any Solutions? Same issue as well.It has been last at least half year. But I cannot fix it. Anyone has solutions?

NSInternalInconsistencyException crash in iOS 17
 
 
Q