I´m trying to use a
NSLayoutConstraint *topEdgeConstraint = [NSLayoutConstraint constraintWithItem:myView attribute: NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:window.contentLayoutGuide attribute:NSLayoutAttributeTop];
Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal.
Edit: this solution is no longer acceptable since OS X El Capitan which has a different views hierarchy in a window frame. Look for the sam's answer where he suggests to use a new NSLayoutConstraint methods and properties (constraints activation) that were introduced in Yosemite.
I've faced the same issue yesterday