Reputation: 5010
I'm moving some views changing its constraints programmatically and at certain point I get this:
2013-11-12 02:26:35.169 App[27290:70b] 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)
(
"<NSLayoutConstraint:0x8b43490 V:[UIButton:0x8b43370(44)]>",
"<NSLayoutConstraint:0x8b413e0 V:|-(0)-[UITableView:0xe1f0200] (Names: '|':UIView:0x8b46430 )>",
"<NSLayoutConstraint:0x8b41410 V:[UIButton:0x8b43370]-(0)-| (Names: '|':UIView:0x8b46430 )>",
"<NSLayoutConstraint:0x8b41470 V:[UITableView:0xe1f0200]-(0)-[UIButton:0x8b43370]>",
"<NSLayoutConstraint:0x8b41680 V:|-(220)-[UIView:0x8b46430] (Names: '|':UIView:0x8b463a0 )>",
"<NSLayoutConstraint:0x8b444a0 V:[UIView:0x8b46430]-(404)-| (Names: '|':UIView:0x8b463a0 )>",
"<NSLayoutConstraint:0x8b445d0 V:[UIView:0x8b463a0]-(0)-| (Names: '|':FXBlurView:0x8b460c0 )>",
"<NSLayoutConstraint:0x8b44630 V:|-(0)-[UIView:0x8b463a0] (Names: '|':FXBlurView:0x8b460c0 )>",
"<NSLayoutConstraint:0x8b44ce0 V:|-(0)-[FXBlurView:0x8b460c0] (Names: '|':UIView:0x8b448d0 )>",
"<NSLayoutConstraint:0x8b44760 V:[FXBlurView:0x8b460c0]-(0)-[_UILayoutGuide:0x8b44790]>",
"<_UILayoutSupportConstraint:0x8b46790 V:[_UILayoutGuide:0x8b44790(0)]>",
"<_UILayoutSupportConstraint:0x8b57e40 _UILayoutGuide:0x8b44790.bottom == UIView:0x8b448d0.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x8b5aed0 h=--& v=--& V:[UIView:0x8b448d0(568)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x8b43490 V:[UIButton:0x8b43370(44)]>
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.
2013-11-12 02:26:35.170 App[27290:70b] 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)
(
"<NSLayoutConstraint:0x8b41680 V:|-(220)-[UIView:0x8b46430] (Names: '|':UIView:0x8b463a0 )>",
"<NSLayoutConstraint:0x8b444a0 V:[UIView:0x8b46430]-(404)-| (Names: '|':UIView:0x8b463a0 )>",
"<NSLayoutConstraint:0x8b445d0 V:[UIView:0x8b463a0]-(0)-| (Names: '|':FXBlurView:0x8b460c0 )>",
"<NSLayoutConstraint:0x8b44630 V:|-(0)-[UIView:0x8b463a0] (Names: '|':FXBlurView:0x8b460c0 )>",
"<NSLayoutConstraint:0x8b44ce0 V:|-(0)-[FXBlurView:0x8b460c0] (Names: '|':UIView:0x8b448d0 )>",
"<NSLayoutConstraint:0x8b44760 V:[FXBlurView:0x8b460c0]-(0)-[_UILayoutGuide:0x8b44790]>",
"<_UILayoutSupportConstraint:0x8b46790 V:[_UILayoutGuide:0x8b44790(0)]>",
"<_UILayoutSupportConstraint:0x8b57e40 _UILayoutGuide:0x8b44790.bottom == UIView:0x8b448d0.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x8b5aed0 h=--& v=--& V:[UIView:0x8b448d0(568)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x8b444a0 V:[UIView:0x8b46430]-(404)-| (Names: '|':UIView:0x8b463a0 )>
Break on objc_exception_throw to catch this in the debugger.
How can I understand which is the problem the causes the warning/error?
Where can I learn how to "read" these warnings?
I mean for example what's the meaning of V:[UIView:0x8b46430]-(404)-|
.
Upvotes: 0
Views: 1071
Reputation: 8664
V:[UIView:0x8b46430]-(404)-|
That line translate to : a UIView is 404pt from the bottom edge of it's superview (inside it's superview)
NSLayoutConstraint:0x8b41680 V:|-(220)-[UIView:0x8b46430] (Names: '|':UIView:0x8b463a0 ) NSLayoutConstraint:0x8b444a0 V:[UIView:0x8b46430]-(404)-| (Names: '|':UIView:0x8b463a0 ) NSLayoutConstraint:0x8b445d0 V:[UIView:0x8b463a0]-(0)-| (Names: '|':FXBlurView:0x8b460c0 )
The view 0x8b46430 has a 404pt relation to a container UIView:0x8b463a0 and at the same time have the same constraint set to 0pt to a container FXBlurView:0x8b460c0.
Upvotes: 1
Reputation: 5010
Found the solution. The problem was that the order in which you edit the constraints MATTERS!
The two conflicting constraints were these:
"<NSLayoutConstraint:0x8b41680 V:|-(220)-[UIView:0x8b46430] (Names: '|':UIView:0x8b463a0 )>",
"<NSLayoutConstraint:0x8b444a0 V:[UIView:0x8b46430]-(404)-| (Names: '|':UIView:0x8b463a0 )>",
This UIView
have a top space margin from its superview of 220 pt and a bottom space margin of 404 pt which is wrong because it's more than the main view height (which is 568 pt tall).
The wrong code was this one:
self.myViewTopMarginCon.constant = $value;
self.myViewBottomMarginCon.constant = $value;
The correct one is this:
self.myViewBottomMarginCon.constant = $value;
self.myViewTopMarginCon.constant = $value;
Upvotes: 0