Reputation: 1535
I got this crashlog when I click on tabbar tabitem to change viewcontroller:
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0xdb98e30 h=--- v=--- H:[UIWindow:0xc65c530(320)]>",
"<NSAutoresizingMaskLayoutConstraint:0xdbba9a0 h=-&- v=-&- UITransitionView:0xdb43ab0.width == UILayoutContainerView:0xdb42ef0.width>",
"<NSAutoresizingMaskLayoutConstraint:0xc680b80 h=-&- v=-&- UILayoutContainerView:0xdb42ef0.width == UIWindow:0xc65c530.width>",
"<NSAutoresizingMaskLayoutConstraint:0x119352f0 h=-&- v=-&- UIViewControllerWrapperView:0xc68a2c0.width == UITransitionView:0xdb43ab0.width>"
)
Will attempt to recover by breaking constraint
<NSAutoresizingMaskLayoutConstraint:0x119352f0 h=-&- v=-&- UIViewControllerWrapperView:0xc68a2c0.width == UITransitionView:0xdb43ab0.width>
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Upvotes: 1
Views: 902
Reputation:
First, how are you applying these constraints? The most common cause of these conflict messages is adding constraints without ensuring they are the only ones the view has. Have you set the property
translatesAutoresizingMaskIntoConstraints = NO
before trying to set more? Because you are getting this exception at runtime it looks like Xcode has accepted what you are trying to do so you are probably adding constraints in code.
Did you add all of those constraints in the list that are given as conflicting? If so, remove them and replace them one by one to find which one you got wrong.
If you are doing all this in Xcode in what we used to know of as Interface Builder, use the new tools to examine all of the constraints and verify that you have not added constraints that conflict. Xcode can help you here.
If you are adding constraints in code but you have created the view in IB then you probably want to either manage all constraints in IB or you want to set the xib to NOT use autolayout, so that it does not apply constraints that conflict with what you later add.
Upvotes: 1