This error is logged to the console when some part of the code is changing UI items from other threads than the main thread. But how can I find where it does this?
Main problem with "This application is modifying the autolayout engine from a background thread" is that it seem to be logged a long time after the actual problem occurs, this can make it very hard to troubleshoot.
I managed to solve the issue by creating three symbolic breakpoints.
Debug > Breakpoints > Create Symbolic Breakpoint...
Breakpoint 1:
Symbol:
-[UIView setNeedsLayout]
Condition:
!(BOOL)[NSThread isMainThread]
Breakpoint 2:
Symbol:
-[UIView layoutIfNeeded]
Condition:
!(BOOL)[NSThread isMainThread]
Breakpoint 3:
Symbol:
-[UIView updateConstraintsIfNeeded]
Condition:
!(BOOL)[NSThread isMainThread]
With these breakpoints, you can easily get a break on the actual line where you incorrectly call UI methods on non-main thread.
!(BOOL)[NSThread isMainThread]
. –
Tamishatamma © 2022 - 2024 — McMap. All rights reserved.