title: View hierarchy constraint error
body: <h2>Summary</h2>
  
  <p>I have an iOS project that comes from the Xcode Master-Detail template. However, I am encountering a "view hierarchy is not prepared for the constraint" error. The table cells in the master view have a tap gesture recognizer that segues to the detail view when a cell is pressed. On the second tap, the program crashes with the aforementioned error. Other issues related to this seem to happen when generating constraints from code, however I have been using the Interface Builder exclusively, so I haven't been able to find another case just like mine. </p>
  
  <p>The detail view contains a UITableView and a UIToolbar. What's causing this? Thanks for your help.</p>
  
  <h2>Xcode output</h2>
  
  <pre><code>The view hierarchy is not prepared for the constraints: &lt;NSLayoutConstraint:0x16d79980 V:[_UILayoutGuide:0x16d791b0]-(44)-[UITableView:0x1729b000]&gt;
  When added to a view, the constraints items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
  *** Assertion failure in -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment: mutallyExclusiveConstraints:]
  *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'
  </code></pre>
  
  <h2>Constraints on the tableview in the detail controller:</h2>
  
  <p><img src="https://imgur.com/KQECWGa.png" alt=""></p>
  
  <h2>Constraints on the toolbar in the detail controller:</h2>
  
  <p><img src="https://i.imgur.com/kmGfMVj.png" alt=""></p>