Below is the error message I receive in the debug area. It runs fine and nothing is wrong except that I receive this error. Would this prevent apple accepting the app? How do I fix it?
2012-07-26 01:58:18.621 Rolo[33597:11303] 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:0x887d630 h=--& v=--& V:[UIButtonLabel:0x886ed80(19)]>",
"<NSAutoresizingMaskLayoutConstraint:0x887d5f0 h=--& v=--& UIButtonLabel:0x886ed80.midY == + 37.5>",
"<NSAutoresizingMaskLayoutConstraint:0x887b4b0 h=--& v=--& V:[UIButtonLabel:0x72bb9b0(19)]>",
"<NSAutoresizingMaskLayoutConstraint:0x887b470 h=--& v=--& UIButtonLabel:0x72bb9b0.midY == - 0.5>",
"<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>",
"<NSLayoutConstraint:0x72c2430 UILabel:0x72bfad0.top == UILabel:0x72bf7c0.top>",
"<NSLayoutConstraint:0x72c2370 UILabel:0x72c0270.top == UILabel:0x72bfad0.top>",
"<NSLayoutConstraint:0x72c22b0 V:[UILabel:0x72bf7c0]-(NSSpace(8))-[UIButton:0x886efe0]>",
"<NSLayoutConstraint:0x72c15b0 V:[UILabel:0x72c0270]-(NSSpace(8))-[UIRoundedRectButton:0x72bbc10]>",
"<NSLayoutConstraint:0x72c1570 UIRoundedRectButton:0x72bbc10.baseline == UIRoundedRectButton:0x7571170.baseline>",
"<NSLayoutConstraint:0x72c21f0 UIRoundedRectButton:0x7571170.top == UIButton:0x886efe0.top>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x72bf860 V:[UILabel:0x72bf7c0(17)]>
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.
Here is my experience and Solution. I didn't touched code
The problem you're having is the NSAutoresizingMaskLayoutConstraints should not be in there. This is the old system of springs and struts. To get rid of it, run this method on each view that you're wanting to constrain:
I would recommend to debug and find which constraint is "the one you don't want". Suppose you have following issue:
Always the problem is how to find following Constraints and Views.
There are two solutions how to do this:
Since you know where to find unexpected constraints (PBOUserWorkDayHeaderView) there is a way to do this fairly well. Lets find
UIView
andNSLayoutConstraint
in red rectangles. Since we know their id in memory it is quite easy.As you can see, the memory pointers are the same. So we know what is going on now. Additionally you can find
NSLayoutConstraint
in view hierarchy. Since it is selected in View, it selected in Navigator also.If you need you may also print it on console using address pointer:
You can do the same for every constraint the debugger will point to you:-) Now you decide what to do with this.
PRINT IT BETTER (I really recommend this way, this is of Xcode 7)
NSLayoutConstraint
:SWIFT:
OBJECTIVE-C
id
you can simple tap it in your Find Navigator:HOW TO SIMPLE FIX THAT CASE?
999
for broken constraint.Be careful, that you do not use more than one constraint in the same direction and type.
For example: Vertical constraint for trailing = 15 and another one is >= 10.
Sometimes, Xcode creates some constraints you don't notice. You have to get rid of redundant constraints and the log warning will surely disappear.
Additionaly, you can read and detect some certain reasons, directly from the log:
This we can read as problem in UILabel constraint, it is leading vertical constraint being 15pt long.
This would be trailing horizontal constraint etc.
For me the main reason of this problem was that I forgot to uncheck
AutoLayout
in theXib
editor. In fact, I did a lot of adjustments of theXIB
in code.use swift this code