Removing Arranged Subviews from UIStackView Crashes App
<p>I have a UIStackView in IB and I am removing and adding subviews in viewDidLoad. When removing subviews it crashes.</p>

<pre><code>[self.headerStackView.arrangedSubviews each:^(UIView *subview) {
    [self.headerStackView removeArrangedSubview:subview];
    [subview removeConstraints:subview.constraints];
    [subview removeFromSuperview];
}];
</code></pre>

<p>Debugger:</p>

<pre><code>2016-11-29 12:35:18.568137 RocheUnregulated[2211:937474] [LayoutConstraints] View hierarchy unprepared for constraint.
Constraint: &lt;NSLayoutConstraint:0x17429ec80 'UISV-spacing' H:[EntryItemInfoView:0x10fe10840]-(15)-[EntryItemInfoView:0x10fd85e50]   (active)&gt;
Container hierarchy: 
&lt;UIStackView: 0x10fe14160; frame = (125 12; 183 51); opaque = NO; autoresize = RM+BM; layer = &lt;CATransformLayer: 0x1700351c0&gt;&gt;
 | &lt;EntryItemInfoView: 0x10fd85e50; frame = (66 0; 51 51); autoresize = RM+BM; layer = &lt;CALayer: 0x1702308e0&gt;&gt;
 |    | &lt;UIStackView: 0x10fd86570; frame = (10 10; 31 31); opaque = NO; autoresize = RM+BM; layer = &lt;CATransformLayer: 0x170230b00&gt;&gt;
 |    |    | &lt;UILabel: 0x10fd86730; frame = (0 0; 31 20.5); text = '45'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = &lt;_UILabelLayer: 0x170480f00&gt;&gt;
 |    |    | &lt;UILabel: 0x10fd86c50; frame = (0 20.5; 31 10.5); text = 'grams'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = &lt;_UILabelLayer: 0x170299410&gt;&gt;
 | &lt;EntryItemInfoView: 0x10fd86ed0; frame = (132 0; 51 51); autoresize = RM+BM; layer = &lt;CALayer: 0x170230ac0&gt;&gt;
 |    | &lt;UIStackView: 0x10fd62a00; frame = (10 10; 31 31); opaque = NO; autoresize = RM+BM; layer = &lt;CATransformLayer: 0x170230b60&gt;&gt;
 |    |    | &lt;UILabel: 0x10fd870d0; frame = (0 0; 31 20.5); text = '10'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = &lt;_UILabelLayer: 0x170481d10&gt;&gt;
 |    |    | &lt;UILabel: 0x10fd87350; frame = (0 20.5; 31 10.5); text = 'units'; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = &lt;_UILabelLayer: 0x170481090&gt;&gt;
View not found in container hierarchy: &lt;EntryItemInfoView: 0x10fe10840; frame = (0 0; 51 51); autoresize = RM+BM; layer = &lt;CALayer: 0x17422ad20&gt;&gt;
That view's superview: NO SUPERVIEW
</code></pre>