IOS 8 Xcode 6: app consistently crashes when using top / bottom layout for top / bottom constraints

Xcode 6 betas have been killing me lately.

I have the following view hierarchy in my storyboard ...

enter image description here

When I control the drag from Header View to View (or vice versa), I only get Top / Bottom Space to Top / Bottom Layout Guide options instead of Top / Bottom Space for Container. And when I choose to attach to the top and bottom level layout guide, the app usually crashes. In any case, you must force the view to create constraints from supervisor instead of layout guides.

Or what is the best way to get around this ?!

This is the error I am getting:

2014-09-02 15:38:07.913 BundleUp[2183:103534] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x7fb773fb07e0 SCHeaderView:0x7fb773fb05d0.centerX == _UILayoutGuide:0x7fb773facca0.centerX>
    When added to a view, the constraint 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.
2014-09-02 15:38:07.914 BundleUp[2183:103534] *** Assertion failure in -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:], /SourceCache/UIKit_Sim/UIKit-3302.3.1/NSLayoutConstraint_UIKitAdditions.m:552
2014-09-02 15:38:07.917 BundleUp[2183:103534] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'

      

And that was after Xcode suggested the restrictions itself by choosing "Reset for suggested restrictions".

+3


source to share


1 answer


If this starts with you, I figured out how to fix the problem. Sometimes when you create constraints and remove them from the Size inspector (delete by selecting the constraint and clicking the delete button), the constraint is not actually removed, but becomes grayed out. I still don't know what that means ... why they stick with it, but I know they affect the layout anyway and it's because of their existence that the application is crashing. Remove these restrictions and everything will work as it should. For information on how to remove hidden limits, see my answer for iOS 8 Xcode 6: What is the point of gray-hidden limits? ...



+1


source







All Articles