title: iOS9 - This application is modifying the autolayout engine from a background thread -- where?
body: <p>For searching, the error message is:</p>
  
  <blockquote>
    <p>This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release.</p>
  </blockquote>
  
  <p>I know this means some UIKit code is called from a background thread, and I know the solution is to wrap the code in </p>
  
  <p><code>dispatch_async(dispatch_get_main_queue(), ^(void){ &lt;code&gt; });</code></p>
  
  <p>My problem is locating where to do that, as none of the printed stack traces reference my app code.  My evidence to prove this negative is searching (command-f) in the debug output window for the name of my app; I have 24 stack traces dumped out and my app name is not in any of them, except at the top with the error message.  I can post one of them, but that doesn't seem very useful.</p>
  
  <p>In the cases I am working on today, this is happening when transitioning view controllers, after <code>viewWillDisappear()</code> and before <code>viewWillAppear()</code>.  I have found parts of my code to wrap <code>dispatch_async()</code> around, but those are all handled now.  I have breakpoints and debug messages where objects relevant to the view controllers are allocated and deallocated, and they all trigger after the exception messages appear.  This is happening both on the simulator and my iOS9 iPhone, both in debug and release modes.</p>
  
  <p>How can I identify the background code which is apparently modifying the UI?</p>