0
votes

On a well working application, I just did the strings translation in code and storyboard and then, I get an 'Unable to simultaneously satisfy constraints' error.

The error is:

    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:0x1d5408d0 V:[UIView:0x1d540c40(0)]>",
 "<NSLayoutConstraint:0x1d540910 V:|-(0)-[UIView:0x1d540c40]   (Names: '|':UIView:0x1d541100 )>",
 "<NSLayoutConstraint:0x1d540fd0 V:[UILabel:0x1d541040(21)]>",
 "<NSLayoutConstraint:0x1d5407d0 V:[UIView:0x1d540c40]-(20)-[UILabel:0x1d541040]>",
 "<NSLayoutConstraint:0x1d540710 V:[LTSelectView:0x1d542210]-(360)-|   (Names: '|':UIView:0x1d541100 )>",
 "<NSAutoresizingMaskLayoutConstraint:0x1d5928b0 h=--& v=--& V:[UIView:0x1d541100(416)]>",
 "<NSLayoutConstraint:0x1d540690 V:[UILabel:0x1d541040]-(19)-[LTSelectView:0x1d542210]>"
 )

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1d540fd0 V:[UILabel:0x1d541040(21)]>

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.

Does the translation somewhere responsible of it?

I read few posts on this subject but reasons are really not easy to understand for me.

So my objects are:

UILabel: Height equals 21 Width equals: 220 Top space to top Layout: 17 Align center X to: superview Bottom space to Selectview: 22

LTSelectView: Width equals to: 160 Height equals to: 30 Align center X to: superview Top space to UILabel: 22 Bottom space to UIButton: 67

UIButton: Width equals to: 100 Height equals to: 30 Top space to SelectView: 67 Align center to: superview

And in fact I can see the UILabel, the UIButton but not the LTSelectView. So the problem is certainly here. I trie to use the obj_exception_throw but I did get anything.

After other tests, I only the problem on iOS6. Things go well on iOS7.

1
Did you add the constraints in code? There is this NSAutoresizingMaskLayoutConstraint which looks like you forgot to set the translatesAutoresizingMasksToContraints to NO. - dasdom
No I didn't add any constraints in code and in doubt, I add this line in my viewDidLoad method and the result is a pure nightmare! Nothing is in a right location anymore. - fralbo
Then my answer is: Your constraints aren't correct. - dasdom

1 Answers

0
votes

One of your label has too many vertical constraints and they can not be satisfied at the same time.

Change the priority of some constraints or rebuild them.