Crash on AutoLayout: Location anchors require being paired : <p>The app is crashing on <code>Location anchors require being paired.</code>. I would like to fix it, however no matter how many times did I manually tested the app with this view, I've never run into the crash (got only logs on Crashlytics). Anyone knows what may be wrong here, under what circumstances the crash may happen?</p>

<p>The property <code>centerYConstraint</code> is required because later it allows the user to move the view up/down. </p>

<p>Part of <code>MyView.m</code> file. The crash happens on setting <code>self.centerYConstraint</code>.</p>

<pre><code>- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];

    self.centerYConstraint = [self.view.centerYAnchor constraintEqualToAnchor:self.parentViewController.view.centerYAnchor 
                                                      constant:self.view.center.y - self.parentViewController.view.center.y];
    self.centerYConstraint.active = YES;
}
</code></pre>

<p>Crash log:</p>

<pre><code>Fatal Exception: NSInvalidArgumentException
NSLayoutConstraint for &lt;NSLayoutYAxisAnchor:0x16764ae0 "MyView:0x18e6b900.centerY"&gt;: 
A constraint cannot be made from &lt;NSLayoutYAxisAnchor:0x16764ae0 "MyView:0x18e6b900.centerY"&gt; to a constant. 
Location anchors require being paired.
</code></pre>
