2

I am getting some auto layout assertions due to UI tasks getting called from background thread. To track this I added a symbolic breakpoint for

-[NSISEngine _optimizeWithoutRebuilding] 

This breakpoint is getting called but I don't have the stack trace from my code. I checked all the threads when it hit this assertion and no useful information from where it was invoked in my code.

 This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.
 Stack:(
0   Foundation                          0x000000010cd1752a _AssertAutolayoutOnAllowedThreadsOnly + 77
1   Foundation                          0x000000010cd17251 -[NSISEngine _optimizeWithoutRebuilding] + 61
2   Foundation                          0x000000010cd1717f -[NSISEngine optimize] + 108
3   Foundation                          0x000000010cd123a5 -[NSISEngine performPendingChangeNotifications] + 84
4   UIKitCore                           0x00000001187e7cc8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2192
5   QuartzCore                          0x000000010da41eae -[CALayer layoutSublayers] + 173
6   QuartzCore                          0x000000010da46b88 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396
7   QuartzCore                          0x000000010da52ee4 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 72
8   QuartzCore                          0x000000010d9c23aa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 328
9   QuartzCore                          0x000000010d9f9584 _ZN2CA11Transaction6commitEv + 608
10  QuartzCore                          0x000000010d9fa435 _ZN2CA11Transaction14release_threadEPv + 201
11  libsystem_pthread.dylib             0x0000000115cd66ab _pthread_tsd_cleanup + 551
12  libsystem_pthread.dylib             0x0000000115cd9655 _pthread_exit + 70
13  libsystem_pthread.dylib             0x0000000115cd643a _pthread_wqthread_exit + 74
14  libsystem_pthread.dylib             0x0000000115cd5644 _pthread_wqthread + 472
15  libsystem_pthread.dylib             0x0000000115cd53fd start_wqthread + 13

Question : Is there some other method I should put a breakpoint in or any better way to track this ?

Update: I added the breakpoints as mentioned, it hit the breakpoint but the call stack doesn't show what caused the breakpoint. See screenshots.

Call Stack 1

Call Stack 2

I have a simple tableview on a screen, initially I don't get these assertions, just staying on that screen for a while triggers these assertions.

ArdenDev
  • 4,051
  • 5
  • 29
  • 50
  • Were you getting *""This application is modifying the autolayout engine from a background thread..."* error / warning messages in the debug console output? Or was your app crashing on *"auto layout assertions"*? (and, are you using Swift or Obj-C?) – DonMag Jun 27 '19 at 13:43
  • @DonMag Getting this error from the console and my code is in Obj-C – ArdenDev Jun 27 '19 at 13:45
  • Take a look at the discussions here: https://stackoverflow.com/questions/28302019/getting-a-this-application-is-modifying-the-autolayout-engine-from-a-background – DonMag Jun 27 '19 at 13:46
  • Thank you @DonMag – ArdenDev Jun 27 '19 at 13:52

0 Answers0