2

What does it mean

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.

(
           "<NSLayoutConstraint:0x7f871d1303b0 H:               [UIButton:0x7f871d197640(30)]>",   
"<NSLayoutConstraint:0x7f871d1a1c40 H:[UIButton:0x7f871d196960'LB'(30)]>",
"<NSLayoutConstraint:0x7f871d1a4570 H:[UIView:0x7f871d196d60]-(100.8)-|   (Names: '|':UIView:0x7f871ac66870 )>",
"<NSLayoutConstraint:0x7f871d1a5200 H:|-(0)-[UIView:0x7f871d196d60]   (Names: '|':UIView:0x7f871ac66870 )>",
"<NSLayoutConstraint:0x7f871d19c5f0 H:[UIView:0x7f871ac66870]-(0)-|   (Names: '|':UIView:0x7f871d199d70 )>",
"<NSLayoutConstraint:0x7f871d19c640 H:|-(20)-[UIView:0x7f871ac66870]   (Names: '|':UIView:0x7f871d199d70 )>",
"<NSLayoutConstraint:0x7f871d1a8ca0 H:|-(0)-[UIView:0x7f871d199d70]   (Names: '|':UIView:0x7f871d199c00 )>",
"<NSLayoutConstraint:0x7f871d1a8d40 UIView:0x7f871d19c820.width == UIView:0x7f871d199d70.width>",
"<NSLayoutConstraint:0x7f871d1a8de0 H:[UIView:0x7f871d199d70]-(10)-[UIView:0x7f871d19c820]>",
"<NSLayoutConstraint:0x7f871d1a8e80 H:[UIView:0x7f871d19c820]-(10)-[UIView:0x7f871d1a7000]>",
"<NSLayoutConstraint:0x7f871d1a8f20 UIView:0x7f871d1a7000.width == UIView:0x7f871d199d70.width>",
"<NSLayoutConstraint:0x7f871d1a8f70 H:[UIView:0x7f871d1a7000]-(0)-|   (Names: '|':UIView:0x7f871d199c00 )>",
"<NSLayoutConstraint:0x7f871d1a9450 H:|-(15)-[UIButton:0x7f871d197640]   (Names: '|':UIView:0x7f871d19b130 )>",
"<NSLayoutConstraint:0x7f871d1a9540 H:[UIButton:0x7f871d197640]-(10)-[UIView:0x7f871d199c00]>",
"<NSLayoutConstraint:0x7f871d1a95e0 H:[UIView:0x7f871d199c00]-(10)-[UIButton:0x7f871d196960'LB']>",
"<NSLayoutConstraint:0x7f871d1a96d0 H:[UIButton:0x7f871d196960'LB']-(10)-|   (Names: '|':UIView:0x7f871d19b130 )>",
"<NSLayoutConstraint:0x7f871d1aa340 H:[UIView:0x7f871d19b130]-(0)-|   (Names: '|':UIView:0x7f871d19afc0 )>",
"<NSLayoutConstraint:0x7f871d1aa390 H:|-(0)-[UIView:0x7f871d19b130]   (Names: '|':UIView:0x7f871d19afc0 )>",
"<NSLayoutConstraint:0x7f871d1b7230 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f871d19afc0(320)]>"
)

Will attempt to recover by breaking constraint 

 Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to   catch this in the debugger.
 The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
vadian
  • 274,689
  • 30
  • 353
  • 361
Evgenii
  • 422
  • 2
  • 14
  • it means you have added an unnecessary constraint in your view. It can be more then one constraint you added which are not needed. – Wolverine May 30 '16 at 13:18
  • 1
    Actually it means exactly what it says. ;-) And below the last line *breaking constraint* there is the constraint which is going to be ignored. – vadian May 30 '16 at 13:19
  • 1
    It doesn't necessarily mean that *you* added the constraint, but somehow between the constraints you have added and those the system added for you, they can't all work together. Constraints define a system of equations which is solved at runtime to position views. When the system has no solution, you get that error. – dylansturg May 30 '16 at 13:20
  • There are **a lot** of topics out there related to `Unable to simultaneously satisfy constraints.` which in turn related to Autolayout. [this](http://stackoverflow.com/q/14327145/1492173) and [this](http://stackoverflow.com/q/11664115/1492173) and many more others. – Yevhen Dubinin May 30 '16 at 13:20

2 Answers2

1

That means you are giving more constraints than required so it's creates ambiguity.

For example if you have one label having height of 30.

Now you give constraints like top,leading and trailing with constant of 20 and fixed height of 30. that means your label always maintain space of 20 of each side from top,left and right and always keep height of 30.

That's fine.

now if you add one another constraint say fixed width with constant 50 that means label's width should be 50.

Now if your app running on 4 inch device then your screen width is 320.

So, if label maintain width of 50 then can't maintain left and right spacing of 20 and if it maintains spacing of 20 then can't maintain width.

This situation is called ambiguity.

This was an example for understanding.

Your constraints making this kind of ambiguity somewhere, so check twice and remove unnecessary or additional constraints.

hope this will help :)

Ketan Parmar
  • 27,092
  • 9
  • 50
  • 75
0

Probably, something is wrong with constraints for UIView:0x7f871d199d70: as I see, you and/or XCode added offsets and also width.

Oleshko
  • 2,923
  • 4
  • 17
  • 25