Programmatically attempting NSLayoutContraint gives "Unable to simultaneously satisfy constraints." - ios

I seem to be having some problems settings up my constraints programmatically for a UITableView I am using. My attempt is below, and have tried every combination of using the translatesAutoresizingMaskIntoConstraints possible.
self.view.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:#"V:|-100-[_tableView]-20-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_tableView)]];
I am just trying to add a space to the beginning and bottom of my UITableView on a UIViewController. Could anyone help with this?
The long, long error is below.
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:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>",
"<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>
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-04-04 20:06:57.648 New eCard[29731:c07] 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:0x75c8540 h=-&- v=-&- UITableView:0x799e400.height == UIView:0x71a4ec0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5a60 V:|-(100)-[UITableView:0x799e400] (Names: '|':UIView:0x71a4ec0 )>
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.
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:0x75c8540 h=-&- v=-&- UITableView:0x799e400.height == UIView:0x71a4ec0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x75c8500 h=-&- v=-&- UITableView:0x799e400.midY == UIView:0x71a4ec0.midY>",
"<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x71a5800 V:[UITableView:0x799e400]-(20)-| (Names: '|':UIView:0x71a4ec0 )>
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.

I found this issue about UICollectionView. I guess that is a good point to start debugging.
UICollectionView Cell + UiLabel with AutoLayout
Some other links with solutions I tried without success :
https://blog.safaribooksonline.com/2012/10/27/tip-unsatisfiable-auto-layouts-in-ios-6/
UITableView with autolayout and offset constraints

Related

Add constraints programmatically

I have 5 buttons I want to place on screen programmatically.
I want them to be 17px above the bottom of the view, and 20px space between every button.
I've done that like this:
let button1 = UIButton(frame: CGRectMake(20, 48, 50, 50))
button1.setImage(UIImage(named: "button1"), forState: .Normal)
let button2 = UIButton(frame: CGRectMake(91, 48, 50, 50))
button2.setImage(UIImage(named: "button2"), forState: .Normal)
let button3 = UIButton(frame: CGRectMake(162, 48, 50, 50))
button3.setImage(UIImage(named: "button3"), forState: .Normal)
let button4 = UIButton(frame: CGRectMake(233, 48, 50, 50))
button4.setImage(UIImage(named: "button4"), forState: .Normal)
let button5 = UIButton(frame: CGRectMake(304, 48, 50, 50))
button5.setImage(UIImage(named: "button5"), forState: .Normal)
self.addSubview(button1)
self.addSubview(button2)
self.addSubview(button3)
self.addSubview(button4)
self.addSubview(button5)
I works great and exactly what I want! But just on iPhone 6s screen size, so I guess the way to make it work on all screen sizes is using constraints, the problem is that I don't have an idea how can I add constraints programmatically.
Can someone help me here?
Thank you!
SaintThread answer, log error:
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:0x7d968a10 h=--& v=--& UIButton:0x79729670.midX == + 45>",
"<NSLayoutConstraint:0x79725610 H:|-(48)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x797255e0 H:[UIButton:0x79729670(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797255e0 H:[UIButton:0x79729670(50)]>
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.
2016-08-17 12:49:14.305 Arounder[3992:10988727] 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:0x7d968a10 h=--& v=--& UIButton:0x79729670.midX == + 45>",
"<NSLayoutConstraint:0x79725610 H:|-(48)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725610 H:|-(48)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.305 Arounder[3992:10988727] 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:0x7d96a3c0 h=--& v=--& UIButton:0x79729670.midY == + 73>",
"<NSLayoutConstraint:0x79725c50 V:|-(20)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x79725ad0 V:[UIButton:0x79729670(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725ad0 V:[UIButton:0x79729670(50)]>
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.
2016-08-17 12:49:14.306 Arounder[3992:10988727] 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:0x7d96a3c0 h=--& v=--& UIButton:0x79729670.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96a3f0 h=--& v=--& V:[UIButton:0x79729670(50)]>",
"<NSLayoutConstraint:0x79725c50 V:|-(20)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725c50 V:|-(20)-[UIButton:0x79729670] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.306 Arounder[3992:10988727] 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:0x7a991c60 h=--& v=--& UIButton:0x79729080.midX == + 116>",
"<NSLayoutConstraint:0x79725560 H:|-(48)-[UIButton:0x79729080] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x79725510 H:[UIButton:0x79729080(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725510 H:[UIButton:0x79729080(50)]>
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.
2016-08-17 12:49:14.306 Arounder[3992:10988727] 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:0x7a991c60 h=--& v=--& UIButton:0x79729080.midX == + 116>",
"<NSAutoresizingMaskLayoutConstraint:0x7a991c90 h=--& v=--& H:[UIButton:0x79729080(50)]>",
"<NSLayoutConstraint:0x79725560 H:|-(48)-[UIButton:0x79729080] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725560 H:|-(48)-[UIButton:0x79729080] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.307 Arounder[3992:10988727] 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:0x7d96a3c0 h=--& v=--& UIButton:0x79729670.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96a3f0 h=--& v=--& V:[UIButton:0x79729670(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7a991cc0 h=--& v=--& UIButton:0x79729080.midY == + 73>",
"<NSLayoutConstraint:0x79725a10 V:[UIButton:0x79729670]-(20)-[UIButton:0x79729080]>",
"<NSLayoutConstraint:0x797259e0 V:[UIButton:0x79729080(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797259e0 V:[UIButton:0x79729080(50)]>
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.
2016-08-17 12:49:14.307 Arounder[3992:10988727] 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:0x7d96a3c0 h=--& v=--& UIButton:0x79729670.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96a3f0 h=--& v=--& V:[UIButton:0x79729670(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7a991cc0 h=--& v=--& UIButton:0x79729080.midY == + 73>",
"<NSLayoutConstraint:0x79725a10 V:[UIButton:0x79729670]-(20)-[UIButton:0x79729080]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725a10 V:[UIButton:0x79729670]-(20)-[UIButton:0x79729080]>
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.
2016-08-17 12:49:14.307 Arounder[3992:10988727] 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:0x7d96b720 h=--& v=--& UIButton:0x79728480.midX == + 187>",
"<NSLayoutConstraint:0x79725490 H:|-(48)-[UIButton:0x79728480] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x79725440 H:[UIButton:0x79728480(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725440 H:[UIButton:0x79728480(50)]>
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.
2016-08-17 12:49:14.308 Arounder[3992:10988727] 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:0x7d96b720 h=--& v=--& UIButton:0x79728480.midX == + 187>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96b750 h=--& v=--& H:[UIButton:0x79728480(50)]>",
"<NSLayoutConstraint:0x79725490 H:|-(48)-[UIButton:0x79728480] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725490 H:|-(48)-[UIButton:0x79728480] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.308 Arounder[3992:10988727] 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:0x7a991cc0 h=--& v=--& UIButton:0x79729080.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7a991cf0 h=--& v=--& V:[UIButton:0x79729080(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96c260 h=--& v=--& UIButton:0x79728480.midY == + 73>",
"<NSLayoutConstraint:0x797259b0 V:[UIButton:0x79729080]-(20)-[UIButton:0x79728480]>",
"<NSLayoutConstraint:0x79725980 V:[UIButton:0x79728480(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725980 V:[UIButton:0x79728480(50)]>
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.
2016-08-17 12:49:14.308 Arounder[3992:10988727] 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:0x7a991cc0 h=--& v=--& UIButton:0x79729080.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7a991cf0 h=--& v=--& V:[UIButton:0x79729080(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96c260 h=--& v=--& UIButton:0x79728480.midY == + 73>",
"<NSLayoutConstraint:0x797259b0 V:[UIButton:0x79729080]-(20)-[UIButton:0x79728480]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797259b0 V:[UIButton:0x79729080]-(20)-[UIButton:0x79728480]>
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.
2016-08-17 12:49:14.309 Arounder[3992:10988727] 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:0x7aad76b0 h=--& v=--& UIButton:0x79727bc0.midX == + 258>",
"<NSLayoutConstraint:0x797253b0 H:|-(48)-[UIButton:0x79727bc0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x79725380 H:[UIButton:0x79727bc0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725380 H:[UIButton:0x79727bc0(50)]>
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.
2016-08-17 12:49:14.309 Arounder[3992:10988727] 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:0x7aad76b0 h=--& v=--& UIButton:0x79727bc0.midX == + 258>",
"<NSAutoresizingMaskLayoutConstraint:0x7aad76e0 h=--& v=--& H:[UIButton:0x79727bc0(50)]>",
"<NSLayoutConstraint:0x797253b0 H:|-(48)-[UIButton:0x79727bc0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797253b0 H:|-(48)-[UIButton:0x79727bc0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.309 Arounder[3992:10988727] 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:0x7d96c260 h=--& v=--& UIButton:0x79728480.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96c290 h=--& v=--& V:[UIButton:0x79728480(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7aad7710 h=--& v=--& UIButton:0x79727bc0.midY == + 73>",
"<NSLayoutConstraint:0x79725950 V:[UIButton:0x79728480]-(20)-[UIButton:0x79727bc0]>",
"<NSLayoutConstraint:0x79725920 V:[UIButton:0x79727bc0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725920 V:[UIButton:0x79727bc0(50)]>
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.
2016-08-17 12:49:14.309 Arounder[3992:10988727] 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:0x7d96c260 h=--& v=--& UIButton:0x79728480.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7d96c290 h=--& v=--& V:[UIButton:0x79728480(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7aad7710 h=--& v=--& UIButton:0x79727bc0.midY == + 73>",
"<NSLayoutConstraint:0x79725950 V:[UIButton:0x79728480]-(20)-[UIButton:0x79727bc0]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725950 V:[UIButton:0x79728480]-(20)-[UIButton:0x79727bc0]>
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.
2016-08-17 12:49:14.310 Arounder[3992:10988727] 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:0x7a993980 h=--& v=--& UIButton:0x797270c0.midX == + 329>",
"<NSLayoutConstraint:0x797252e0 H:|-(48)-[UIButton:0x797270c0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>",
"<NSLayoutConstraint:0x79725290 H:[UIButton:0x797270c0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x79725290 H:[UIButton:0x797270c0(50)]>
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.
2016-08-17 12:49:14.310 Arounder[3992:10988727] 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:0x7a993980 h=--& v=--& UIButton:0x797270c0.midX == + 329>",
"<NSAutoresizingMaskLayoutConstraint:0x7a9939b0 h=--& v=--& H:[UIButton:0x797270c0(50)]>",
"<NSLayoutConstraint:0x797252e0 H:|-(48)-[UIButton:0x797270c0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797252e0 H:|-(48)-[UIButton:0x797270c0] (Names: '|':Arounder.CategoriesBarView:0x797c7190 )>
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.
2016-08-17 12:49:14.310 Arounder[3992:10988727] 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:0x7aad7710 h=--& v=--& UIButton:0x79727bc0.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7aad7a50 h=--& v=--& V:[UIButton:0x79727bc0(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7a993510 h=--& v=--& UIButton:0x797270c0.midY == + 73>",
"<NSLayoutConstraint:0x797258d0 V:[UIButton:0x79727bc0]-(20)-[UIButton:0x797270c0]>",
"<NSLayoutConstraint:0x797258a0 V:[UIButton:0x797270c0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797258a0 V:[UIButton:0x797270c0(50)]>
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.
2016-08-17 12:49:14.311 Arounder[3992:10988727] 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:0x7aad7710 h=--& v=--& UIButton:0x79727bc0.midY == + 73>",
"<NSAutoresizingMaskLayoutConstraint:0x7aad7a50 h=--& v=--& V:[UIButton:0x79727bc0(50)]>",
"<NSAutoresizingMaskLayoutConstraint:0x7a993510 h=--& v=--& UIButton:0x797270c0.midY == + 73>",
"<NSLayoutConstraint:0x797258d0 V:[UIButton:0x79727bc0]-(20)-[UIButton:0x797270c0]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x797258d0 V:[UIButton:0x79727bc0]-(20)-[UIButton:0x797270c0]>
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.
iOS 8 safe
Before adding the buttons to view
button1.translatesAutoresizingMaskIntoConstraints = false
button2.translatesAutoresizingMaskIntoConstraints = false
button3.translatesAutoresizingMaskIntoConstraints = false
button4.translatesAutoresizingMaskIntoConstraints = false
button5.translatesAutoresizingMaskIntoConstraints = false
After adding the buttons to view
let views = ["button1": button1,
"button2": button2,
"button3": button3,
"button4": button4,
"button5": button5]
let buttonConstraintsH = NSLayoutConstraint.constraintsWithVisualFormat(
"H:|-20-[button1]-20-[button2]-20-[button3]-20-[button4]-20-[button5]-20-|",
options: [],
metrics: nil,
views: views)
let button1ConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[button1]-17-|",
options: [],
metrics: nil,
views: views)
let button2ConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[button2]-17-|",
options: [],
metrics: nil,
views: views)
let button3ConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[button3]-17-|",
options: [],
metrics: nil,
views: views)
let button4ConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[button4]-17-|",
options: [],
metrics: nil,
views: views)
let button5ConstraintsV = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[button5]-17-|",
options: [],
metrics: nil,
views: views)
NSLayoutConstraint.activateConstraints([buttonConstraintsH, button1ConstraintsV, button2ConstraintsV, button3ConstraintsV, button4ConstraintsV, button5ConstraintsV])
and to have the same ratio (write it for each button):
NSLayoutConstraint.activateConstraints(NSLayoutConstraint(
item:button1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:button1
attribute:NSLayoutAttributeWidth
multiplier:1
constant:0))
I would recommend you to read more about NSLayoutAnchor (read more) which is easier way of creating constraints.
short snippet:
self.add
self.addSubview(button1)
self.addSubview(button2)
self.addSubview(button3)
self.addSubview(button4)
self.addSubview(button5)
button1.widthAnchor.constraintEqualToConstant(50).active = true
button1.heightAnchor.constraintEqualToConstant(50).active = true
button1.leadingAnchor.constraintEqualToAnchor(self.leadingAnchor, constant: 20).active = true
button1.topAnchor.constraintEqualToAnchor(self.topAnchor, constant: 50).active = true
....

Conflicting constraints on GIDSignInButton in Google Sign-In SDK 2.0.1

I'm trying to upgrade from Google Sign-In SDK 1.0.0 to 2.0.1 and ran into some conflicting constraints when trying to position an instance of the GIDSignInButton.
It seems like GIDSignInButton may define its own dynamic constrains which conflict with the ones I set in Interface Builder. I'm not able to verify this since the SDK is closed source.
The constraint warning can actually be reproduced with Google's own sample code on https://github.com/googlesamples/google-services/tree/81c831d85a67157746009fa2df81a683f860d21e/ios/signin.
Is there a work around to position this button or is this just a bug in SDK 2.0.1?
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:0x7f9e0064b650 V:[UIView:0x7f9e0064b360(198)]>",
"<NSLayoutConstraint:0x7f9e0064b830 UIView:0x7f9e0064b360.centerY == GIDSignInButton.centerY (Names: GIDSignInButton:0x7f9e0046f000 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f9e006603c0 h=--& v=--& GIDSignInButton.midY == + 97 (Names: GIDSignInButton:0x7f9e0046f000 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f9e0064b830 UIView:0x7f9e0064b360.centerY == GIDSignInButton.centerY (Names: GIDSignInButton:0x7f9e0046f000 )>
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.
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:0x7f9e00476cd0 GIDSignInButton.width == 3.26531*GIDSignInButton.height (Names: GIDSignInButton:0x7f9e0046f000 )>",
"<NSLayoutConstraint:0x7f9e00476f20 H:[GIDSignInButton(160)] (Names: GIDSignInButton:0x7f9e0046f000 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f9e00660410 h=--& v=--& V:[GIDSignInButton(44)] (Names: GIDSignInButton:0x7f9e0046f000 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f9e00476cd0 GIDSignInButton.width == 3.26531*GIDSignInButton.height (Names: GIDSignInButton:0x7f9e0046f000 )>
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.
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:0x7f9e0064b7e0 UIView:0x7f9e0064b360.centerX == GIDSignInButton.centerX (Names: GIDSignInButton:0x7f9e0046f000 )>",
"<NSLayoutConstraint:0x7f9e00657480 H:[UIView:0x7f9e0064b360]-(0)-| (Names: '|':UIView:0x7f9e0064b050 )>",
"<NSLayoutConstraint:0x7f9e006574d0 H:|-(0)-[UIView:0x7f9e0064b360] (Names: '|':UIView:0x7f9e0064b050 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f9e0065dda0 h=--& v=--& GIDSignInButton.midX == + 207 (Names: GIDSignInButton:0x7f9e0046f000 )>",
"<NSLayoutConstraint:0x7f9e0046d5e0 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7f9e0064b050(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f9e0064b7e0 UIView:0x7f9e0064b360.centerX == GIDSignInButton.centerX (Names: GIDSignInButton:0x7f9e0046f000 )>
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.
I had the same issue and the solution I found was to embed the google sign-in button in another view and set the constraints on the container.
the only constraints i gave to the GIDSignInButton instance was center (x,y) in container cause otherwise it will still be shifted to the right.
I hope this helps
Google has fixed this bug in Google Sign-In SDK 2.1.0 (released on 6/17/2015).
Fixes Auto Layout issues with GIDSignInButton.

Prevent Interface Builder from auto creating Constraints?

I created a demo project here. I have a view where I created a ScrollView in a .xib file. In interface builder I did not set any constraints. In my viewDidLoad method I set constraints with SnapKit:
scrollView.snp_makeConstraints { (make) -> Void in
make.edges.equalTo(self.view)
}
When I run the code I get the following console output:
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)
(
"<NSIBPrototypingLayoutConstraint:0x7b74e280 'IB auto generated at build time for view with fixed frame' V:|-(1)-[UIScrollView:0x7b74c430] (Names: '|':UIView:0x7b74dd10 )>",
"<<DeviceImagesTest.LayoutConstraint:0x7baa2760> <UIScrollView:0x7b6608d0>.top == <UIView:0x7b64d800>.top>"
)
Will attempt to recover by breaking constraint
<NSIBPrototypingLayoutConstraint:0x7b74e280 'IB auto generated at build time for view with fixed frame' V:|-(1)-[UIScrollView:0x7b74c430] (Names: '|':UIView:0x7b74dd10 )>
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.
2015-05-29 18:37:14.368 DeviceImagesTest[36462:607] 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)
(
"<NSIBPrototypingLayoutConstraint:0x7b74e080 'IB auto generated at build time for view with fixed frame' H:|-(0)-[UIScrollView:0x7b74c430](LTR) (Names: '|':UIView:0x7b74dd10 )>",
"<NSIBPrototypingLayoutConstraint:0x7b74e330 'IB auto generated at build time for view with fixed frame' H:[UIScrollView:0x7b74c430(600)]>",
"<<DeviceImagesTest.LayoutConstraint:0x7baa7170> <UIScrollView:0x7baa7b30>.right == <UIView:0x7baa79a0>.right>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa4800 h=-&- v=-&- UIView:0x7b74dd10.width == UIViewControllerWrapperView:0x7ba9f060.width>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa5180 h=-&- v=-&- UIViewControllerWrapperView:0x7ba9f060.width == UINavigationTransitionView:0x7bc769b0.width>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa58e0 h=-&- v=-&- UINavigationTransitionView:0x7bc769b0.width == UILayoutContainerView:0x7bc75140.width>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa61a0 h=-&- v=-&- UILayoutContainerView:0x7bc75140.width == UIWindow:0x7bc71870.width>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa69a0 h=--- v=--- H:[UIWindow:0x7bc71870(320)]>"
)
Will attempt to recover by breaking constraint
<<DeviceImagesTest.LayoutConstraint:0x7baa95b0> <UIScrollView:0x7baa9610>.right == <UIView:0x7baa96b0>.right>
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.
2015-05-29 18:37:14.496 DeviceImagesTest[36462:607] 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)
(
"<NSIBPrototypingLayoutConstraint:0x7b74e360 'IB auto generated at build time for view with fixed frame' V:[UIScrollView:0x7b74c430(600)]>",
"<<DeviceImagesTest.LayoutConstraint:0x7bc77e40> <UIScrollView:0x7bc7f6a0>.top == <UIView:0x7bc52180>.top>",
"<<DeviceImagesTest.LayoutConstraint:0x7bc49420> <UIScrollView:0x7bc74b00>.bottom == <UIView:0x7bc7b970>.bottom>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa4960 h=-&- v=-&- UIView:0x7b74dd10.height == UIViewControllerWrapperView:0x7ba9f060.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa51e0 h=-&- v=-&- UIViewControllerWrapperView:0x7ba9f060.height == UINavigationTransitionView:0x7bc769b0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa5940 h=-&- v=-&- UINavigationTransitionView:0x7bc769b0.height == UILayoutContainerView:0x7bc75140.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa6200 h=-&- v=-&- UILayoutContainerView:0x7bc75140.height == UIWindow:0x7bc71870.height>",
"<NSAutoresizingMaskLayoutConstraint:0x7baa69d0 h=--- v=--- V:[UIWindow:0x7bc71870(568)]>"
)
Will attempt to recover by breaking constraint
<<DeviceImagesTest.LayoutConstraint:0x7bc84790> <UIScrollView:0x7bc848b0>.bottom == <UIView:0x7bc84860>.bottom>
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.
It seems that Interface Builder is generating Constraints for me even if I did not set any. This leads to a conflict with my constraints I set in code. I also set setTranslatesAutoresizingMasks(false).
How can I prevent Interface Builder from auto generating constraints?
If you are confused about the NSAutoresizingMaskLayoutConstraints in that list, it might be because you haven't called setTranslatesAutoresizingMasksIntoContraints(false) on that view. (although, I was under the impression that SnapKit does that for you).
If you are confused about the NSIBPrototypingLayoutConstraint, that's an auto-generated constraint by Interface Builder. To get rid of it, add some Top, Bottom, Leading and Trailing constraints in Interface Builder and set them to be removed at build time. For more details about that, have a look at http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame/
UPDATE: url was changed to http://travisjeffery.com/b/2013/11/preventing-ib-auto-generated-at-build-time-for-view-with-fixed-frame-when-using-auto-layout/
How can I prevent Interface Builder from auto generating constraints?
Simplest way: select the nib or storyboard in the project navigator, go to the File inspector, and uncheck "Use Auto Layout".

Auto Layout issue with collection view cell

I am trying to create a somewhat basic layout and am having the classic "Unable to simultaneously satisfy constraints" problem. After an hour on it I cannot track it down.
Here is the layout in interface builder:
Please note that no constraints are being added/modified in code. Everything is happening in IB.
Here is the error message I am getting:
2015-03-07 19:13:33.044 TwitterStats[4326:209207] 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:0x7f888ad8b700 H:[UIImageView:0x7f888ad8ce40(90)]>",
"<NSLayoutConstraint:0x7f888ad8f910 H:|-(8)-[UIImageView:0x7f888ad8ce40] (Names: '|':UIView:0x7f888ad8cd70 )>",
"<NSLayoutConstraint:0x7f888ad8fb40 UIView:0x7f888ad8cd70.trailingMargin == UILabel:0x7f888ad87790'#username'.trailing + 10>",
"<NSLayoutConstraint:0x7f888ad8fb90 H:[UIImageView:0x7f888ad8ce40]-(14)-[UILabel:0x7f888ad87790'#username']>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af29690 h=--& v=--& H:[UIView:0x7f888ad8cd70(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ad8b700 H:[UIImageView:0x7f888ad8ce40(90)]>
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.
2015-03-07 19:13:33.045 TwitterStats[4326:209207] 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:0x7f888ad8b210 V:[UIImageView:0x7f888ad8ce40(90)]>",
"<NSLayoutConstraint:0x7f888ad8f450 V:[UIButton:0x7f888ad8f150'Unfollow'(52)]>",
"<NSLayoutConstraint:0x7f888ad8f8c0 V:|-(8)-[UIImageView:0x7f888ad8ce40] (Names: '|':UIView:0x7f888ad8cd70 )>",
"<NSLayoutConstraint:0x7f888ad8fa00 V:[UIImageView:0x7f888ad8ce40]-(10)-[UITableView:0x7f888b840000]>",
"<NSLayoutConstraint:0x7f888ad8fc30 V:[UITableView:0x7f888b840000]-(0)-[UIButton:0x7f888ad8f150'Unfollow']>",
"<NSLayoutConstraint:0x7f888ad8fcd0 V:[UIButton:0x7f888ad8f150'Unfollow']-(0)-| (Names: '|':UIView:0x7f888ad8cd70 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af3cb10 h=--& v=--& V:[UIView:0x7f888ad8cd70(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ad8b210 V:[UIImageView:0x7f888ad8ce40(90)]>
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.
2015-03-07 19:13:33.073 TwitterStats[4326:209207] 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:0x7f888ad8f450 V:[UIButton:0x7f888ad8f150'Unfollow'(52)]>",
"<NSLayoutConstraint:0x7f888ad8f8c0 V:|-(8)-[UIImageView:0x7f888ad8ce40] (Names: '|':UIView:0x7f888ad8cd70 )>",
"<NSLayoutConstraint:0x7f888ad8fa00 V:[UIImageView:0x7f888ad8ce40]-(10)-[UITableView:0x7f888b840000]>",
"<NSLayoutConstraint:0x7f888ad8fc30 V:[UITableView:0x7f888b840000]-(0)-[UIButton:0x7f888ad8f150'Unfollow']>",
"<NSLayoutConstraint:0x7f888ad8fcd0 V:[UIButton:0x7f888ad8f150'Unfollow']-(0)-| (Names: '|':UIView:0x7f888ad8cd70 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af3cb10 h=--& v=--& V:[UIView:0x7f888ad8cd70(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ad8f450 V:[UIButton:0x7f888ad8f150'Unfollow'(52)]>
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.
2015-03-07 19:13:33.111 TwitterStats[4326:209207] 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:0x7f888ac441e0 H:[UIImageView:0x7f888ac87610(90)]>",
"<NSLayoutConstraint:0x7f888ac4f8e0 H:|-(8)-[UIImageView:0x7f888ac87610] (Names: '|':UIView:0x7f888ac7f2c0 )>",
"<NSLayoutConstraint:0x7f888ac8cd20 UIView:0x7f888ac7f2c0.trailingMargin == UILabel:0x7f888ac52b00'#username'.trailing + 10>",
"<NSLayoutConstraint:0x7f888ac48b90 H:[UIImageView:0x7f888ac87610]-(14)-[UILabel:0x7f888ac52b00'#username']>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af3e030 h=--& v=--& H:[UIView:0x7f888ac7f2c0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ac441e0 H:[UIImageView:0x7f888ac87610(90)]>
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.
2015-03-07 19:13:33.113 TwitterStats[4326:209207] 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:0x7f888ac29530 V:[UIImageView:0x7f888ac87610(90)]>",
"<NSLayoutConstraint:0x7f888ac41d40 V:[UIButton:0x7f888ac53e90'Unfollow'(52)]>",
"<NSLayoutConstraint:0x7f888ac4f890 V:|-(8)-[UIImageView:0x7f888ac87610] (Names: '|':UIView:0x7f888ac7f2c0 )>",
"<NSLayoutConstraint:0x7f888ac8b790 V:[UIImageView:0x7f888ac87610]-(10)-[UITableView:0x7f888b035400]>",
"<NSLayoutConstraint:0x7f888ac48c30 V:[UITableView:0x7f888b035400]-(0)-[UIButton:0x7f888ac53e90'Unfollow']>",
"<NSLayoutConstraint:0x7f888ac8ae40 V:[UIButton:0x7f888ac53e90'Unfollow']-(0)-| (Names: '|':UIView:0x7f888ac7f2c0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af2ba00 h=--& v=--& V:[UIView:0x7f888ac7f2c0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ac29530 V:[UIImageView:0x7f888ac87610(90)]>
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.
2015-03-07 19:13:33.114 TwitterStats[4326:209207] 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:0x7f888ac41d40 V:[UIButton:0x7f888ac53e90'Unfollow'(52)]>",
"<NSLayoutConstraint:0x7f888ac4f890 V:|-(8)-[UIImageView:0x7f888ac87610] (Names: '|':UIView:0x7f888ac7f2c0 )>",
"<NSLayoutConstraint:0x7f888ac8b790 V:[UIImageView:0x7f888ac87610]-(10)-[UITableView:0x7f888b035400]>",
"<NSLayoutConstraint:0x7f888ac48c30 V:[UITableView:0x7f888b035400]-(0)-[UIButton:0x7f888ac53e90'Unfollow']>",
"<NSLayoutConstraint:0x7f888ac8ae40 V:[UIButton:0x7f888ac53e90'Unfollow']-(0)-| (Names: '|':UIView:0x7f888ac7f2c0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x7f888af2ba00 h=--& v=--& V:[UIView:0x7f888ac7f2c0(50)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7f888ac41d40 V:[UIButton:0x7f888ac53e90'Unfollow'(52)]>
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.
The strange thing is this constraint <NSAutoresizingMaskLayoutConstraint:0x7f888af2ba00 h=--& v=--& V:[UIView:0x7f888ac7f2c0(50)]>, I don't get where it's coming from.
Any idea on how to solve these issues?
I had same problem yesterday. The NSAutoresizingMaskLayoutConstraint you mentioned was not the problem. I could not figure out where that constraint comes from, but it seems to be normal for collection view cells.
The problem is that the constraints cannot be satisfied. Take a look at the first set of constraints that are not working:
"<NSLayoutConstraint:0x7f888ad8b700 H:[UIImageView:0x7f888ad8ce40(90)]"
"<NSLayoutConstraint:0x7f888ad8f910 H:|-(8)-[UIImageView:0x7f888ad8ce40] (Names: '|':UIView:0x7f888ad8cd70 )>"
"<NSLayoutConstraint:0x7f888ad8fb40 UIView:0x7f888ad8cd70.trailingMargin == UILabel:0x7f888ad87790'#username'.trailing + 10>"
"<NSLayoutConstraint:0x7f888ad8fb90 H:[UIImageView:0x7f888ad8ce40]-(14)-[UILabel:0x7f888ad87790'#username']>"
You have 8 points from the left edge to the image view.
The image view is 90 points wide. You have 14 points from the image view to the username. Then the username is constrained to the trailing margin with 10 points space.
Username is a UILabel and has intrinsic size. Suppose that for a given user it required 40 points to display the username. Your constraints would result in a screen width of 8 + 90 + 14 + 40 + 10 = 162. That would be a very narrow screen! These constraints cannot be satisfied.
The thing to do here is remove this trailing constraint:
"<NSLayoutConstraint:0x7f888ad8fb40 UIView:0x7f888ad8cd70.trailingMargin == UILabel:0x7f888ad87790'#username'.trailing + 10>"
If you are really concerned that the username could be too long, you could try keeping this constraint, but changing it from EQUALS 10 to GREATER THAN OR EQUAL to 10.
I had a similar problem with a UICollectionView in a Storyboard.
The cause for this error is the size of the contentView of the CollectionViewCell. It uses the default size which is (50.0, 50.0). This might be an InterfaceBuilder-Bug.
A fix is to change the priority for your imageView.width (90) and the buttons width (52) to 999.

Custom Cell doesn't load correctly

My custom cell doesn't load as I want it to. I've been changing things around of a long time now, and I know I am just not doing something I'm supposed to be doing.
I didn't do anything besides design the cell, set my constraints on my cell prototype, and assign it the custom class I made for it, which I did not change at all, yet. I assume that's the issue, is that I'm missing methods in the custom cell class.
Here's my design:
Here's what it renders to be:
I don't know what's going on, but my image doesn't show up and the text box ignores constraints. If I'm doing something blatant, or missing something, fill me in?
EDIT: I actually got a crazy long error. Am I supposed to overload something to keep it from auto-layout-ing or something?
2014-07-18 18:23:43.897 MeNext[4703:60b] 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:0x10933fab0 V:[UILabel:0x10933f900(90)]>",
"<NSLayoutConstraint:0x1093411c0 V:|-(0)-[UILabel:0x10933f900] (Names: '|':UITableViewCellContentView:0x10933f820 )>",
"<NSLayoutConstraint:0x109341260 V:[UILabel:0x10933f900]-(0)-| (Names: '|':UITableViewCellContentView:0x10933f820 )>",
"<NSAutoresizingMaskLayoutConstraint:0x10933a2f0 h=--& v=--& V:[UITableViewCellContentView:0x10933f820(91)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10933fab0 V:[UILabel:0x10933f900(90)]>
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.
2014-07-18 18:23:43.900 MeNext[4703:60b] 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:0x109317d90 V:[UILabel:0x109317c50(90)]>",
"<NSLayoutConstraint:0x10933c290 V:|-(0)-[UILabel:0x109317c50] (Names: '|':UITableViewCellContentView:0x109332840 )>",
"<NSLayoutConstraint:0x10933c330 V:[UILabel:0x109317c50]-(0)-| (Names: '|':UITableViewCellContentView:0x109332840 )>",
"<NSAutoresizingMaskLayoutConstraint:0x1095685f0 h=--& v=--& V:[UITableViewCellContentView:0x109332840(91)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x109317d90 V:[UILabel:0x109317c50(90)]>
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.
2014-07-18 18:23:43.902 MeNext[4703:60b] 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:0x109320d30 V:[UILabel:0x109332d50(90)]>",
"<NSLayoutConstraint:0x109337ad0 V:|-(0)-[UILabel:0x109332d50] (Names: '|':UITableViewCellContentView:0x109332c90 )>",
"<NSLayoutConstraint:0x109337b70 V:[UILabel:0x109332d50]-(0)-| (Names: '|':UITableViewCellContentView:0x109332c90 )>",
"<NSAutoresizingMaskLayoutConstraint:0x109348490 h=--& v=--& V:[UITableViewCellContentView:0x109332c90(91)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x109320d30 V:[UILabel:0x109332d50(90)]>
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.
2014-07-18 18:23:43.904 MeNext[4703:60b] 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:0x109340530 V:[UIButton:0x109340340(17)]>",
"<NSLayoutConstraint:0x109340c60 V:[UIButton:0x109340a20(17)]>",
"<NSLayoutConstraint:0x109341120 V:|-(20)-[UIButton:0x109340340] (Names: '|':UITableViewCellContentView:0x10933f820 )>",
"<NSLayoutConstraint:0x109341350 V:[UIButton:0x109340a20]-(20)-| (Names: '|':UITableViewCellContentView:0x10933f820 )>",
"<NSAutoresizingMaskLayoutConstraint:0x10933a2f0 h=--& v=--& V:[UITableViewCellContentView:0x10933f820(91)]>",
"<NSLayoutConstraint:0x1093413a0 V:[UIButton:0x109340340]-(16)-[UIButton:0x109340a20]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x109340c60 V:[UIButton:0x109340a20(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.
2014-07-18 18:23:43.905 MeNext[4703:60b] 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:0x10933b500 V:[UIButton:0x10933b310(17)]>",
"<NSLayoutConstraint:0x10933bd30 V:[UIButton:0x10933baf0(17)]>",
"<NSLayoutConstraint:0x10933c1f0 V:|-(20)-[UIButton:0x10933b310] (Names: '|':UITableViewCellContentView:0x109332840 )>",
"<NSLayoutConstraint:0x10933c420 V:[UIButton:0x10933baf0]-(20)-| (Names: '|':UITableViewCellContentView:0x109332840 )>",
"<NSAutoresizingMaskLayoutConstraint:0x1095685f0 h=--& v=--& V:[UITableViewCellContentView:0x109332840(91)]>",
"<NSLayoutConstraint:0x10933c470 V:[UIButton:0x10933b310]-(16)-[UIButton:0x10933baf0]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x10933bd30 V:[UIButton:0x10933baf0(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.
2014-07-18 18:23:43.906 MeNext[4703:60b] 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:0x1093333d0 V:[UIButton:0x109333200(17)]>",
"<NSLayoutConstraint:0x109336890 V:[UIButton:0x109336670(17)]>",
"<NSLayoutConstraint:0x109337a30 V:|-(20)-[UIButton:0x109333200] (Names: '|':UITableViewCellContentView:0x109332c90 )>",
"<NSLayoutConstraint:0x109337c60 V:[UIButton:0x109336670]-(20)-| (Names: '|':UITableViewCellContentView:0x109332c90 )>",
"<NSAutoresizingMaskLayoutConstraint:0x109348490 h=--& v=--& V:[UITableViewCellContentView:0x109332c90(91)]>",
"<NSLayoutConstraint:0x109337d00 V:[UIButton:0x109333200]-(16)-[UIButton:0x109336670]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x109336890 V:[UIButton:0x109336670(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.
EDIT 2: Here's my CellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"QueueCell" forIndexPath:indexPath];
cell.textLabel.text = _tracks[indexPath.row][#"title"];
if(_thumbnails.count == _tracks.count)
{
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:_thumbnails[indexPath.row]]];
}
return cell;
}
I think you need to subclass your UITableViewCell if you want to put a ImageView where you want it, and have your text follow constraints. Create new class of type UITableViewCell, hook it up in Storyboard, and then use
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:#"QueueCell"];
This works with Storyboard.
dequeueReusableCellWithIdentifier:#"" forIndexPath:indexPath
does not work with Storyboard.
Then, in you cell class, hook up your IBOutlet ImageView, label, etc.

Resources