Auto Layout issue with collection view cell - ios

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.

Related

getting weird log message on console(AutoLayout)

Hiii Guys,
I have a view with 600*450 size, now i put a collection view in a view with 600*430 size. when i am running application i am getting this weird message on console
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:0x600000285960 V:|-(0)-[UICollectionView:0x7fb133860800] (Names: '|':UIView:0x60000019df60 )>",
"<NSLayoutConstraint:0x600000285a50 V:[UICollectionView:0x7fb133860800]-(20)-| (Names: '|':UIView:0x60000019df60 )>",
"<NSLayoutConstraint:0x600000285dc0 V:[_UILayoutGuide:0x6000001b5b60]-(0)-[UIView:0x60000019dc20]>",
"<NSLayoutConstraint:0x600000285e10 UIView:0x60000019dc20.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x6000002860e0 V:[_UILayoutGuide:0x6000001b5b60]-(0)-[UIView:0x60800019d5a0]>",
"<NSLayoutConstraint:0x600000286180 UIView:0x60000019df60.bottom == UIView:0x60000019ddc0.bottom>",
"<NSLayoutConstraint:0x600000286220 UIView:0x60000019df60.top == UIView:0x60800019d5a0.top>",
"<NSLayoutConstraint:0x600000286540 UIView:0x60000019dcf0.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x600000286590 V:[UIView:0x60000019dc20]-(0)-[UIView:0x60000019dcf0]>",
"<NSLayoutConstraint:0x6000002867c0 UIView:0x60000019ddc0.height == 0.25*UIView:0x60000019db50.height>",
"<NSLayoutConstraint:0x6000002868b0 V:[UIView:0x60000019dcf0]-(0)-[UIView:0x60000019ddc0]>",
"<NSLayoutConstraint:0x600000288d40 'UIView-Encapsulated-Layout-Height' V:[UIView:0x60000019db50(0)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600000285a50 V:[UICollectionView:0x7fb133860800]-(20)-| (Names: '|':UIView:0x60000019df60 )>
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 don't know what to do.
I have applied this 4 constraints to UICollectionView.
This occur because few constraint you have added is not required so it is better to select the view and then after Choose Reset to suggested constraint .
and if after this if constraint not up to mark then better to look for each control constraint and check which constraint showing mark (yellow)and try to remove manually and then add.
Hope it helps.

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.

NSLayoutConstrain error when using JSQMessagesViewController

Then view is showed below:
And I scroll down and scroll up many times , there are errors coming.
The code is mostly as same as the sample code in the demo.
2015-05-18 10:15:16.907 HiPDA V2[29096:948402] 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:0x7fa810d4ce20 V: [JSQMessagesLabel:0x7fa810d4ca80(20)]>",
"<NSLayoutConstraint:0x7fa810d4dc40 V:[JSQMessagesLabel:0x7fa810d4d5f0(20)]>",
"<NSLayoutConstraint:0x7fa810d54910 V:[JSQMessagesLabel:0x7fa810d54670(0)]>",
"<NSLayoutConstraint:0x7fa810d55010 V:|-(0)-[JSQMessagesLabel:0x7fa810d4ca80] (Names: '|':UIView:0x7fa810d4c900 )>",
"<NSLayoutConstraint:0x7fa810d55100 V: [JSQMessagesLabel:0x7fa810d4ca80]-(0)-[JSQMessagesLabel:0x7fa810d4d5f0]>",
"<NSLayoutConstraint:0x7fa810d551a0 V:[JSQMessagesLabel:0x7fa810d4d5f0]-(0)-[UIView:0x7fa810d4e1b0]>",
"<NSLayoutConstraint:0x7fa810d55330 V:[JSQMessagesLabel:0x7fa810d54670]-(0)-| (Names: '|':UIView:0x7fa810d4c900 )>",
"<NSLayoutConstraint:0x7fa810d55380 V:[UIView:0x7fa810d4e1b0]-(0)-[JSQMessagesLabel:0x7fa810d54670]>",
"<NSAutoresizingMaskLayoutConstraint:0x7fa8131f45d0 h=--& v=--& V:[UIView:0x7fa810d4c900(38)]>"
)
W ill attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fa810d4dc40 V: [JSQMessagesLabel:0x7fa810d4d5f0(20)]>
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.

Autolayout constraints warning “Will attempt to recover by breaking constraint”

I am trying to implement a feed of news (somehow like instagram without comments or likes). It works, but xcode keep showing this error. I tried change all the constraints, however, I cant get to work. The tableview has a height of 475 and the image has the height of 400, leaving 75 for the white area with labels.
I did use
self.tableView.estimatedRowHeight = 475;
self.tableView.rowHeight = UITableViewAutomaticDimension;
Any help?
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:0x174096530 UIImageView:0x1743e9000.top == UITableViewCellContentView:0x17418af80.topMargin + 13>",
"<NSLayoutConstraint:0x1740977f0 V:[PFImageView:0x1743e8e00]-(0)-| (Names: '|':UITableViewCellContentView:0x17418af80 )>",
"<NSLayoutConstraint:0x174097840 V:[UIImageView:0x1743e9000]-(24)-[PFImageView:0x1743e8e00]>",
"<NSLayoutConstraint:0x174097890 H:|-(0)-[PFImageView:0x1743e8e00] (Names: '|':UITableViewCellContentView:0x17418af80 )>",
"<NSLayoutConstraint:0x174097930 H:[PFImageView:0x1743e8e00]-(0)-| (Names: '|':UITableViewCellContentView:0x17418af80 )>",
"<NSLayoutConstraint:0x174097ac0 PFImageView:0x1743e8e00.width == PFImageView:0x1743e8e00.height>",
"<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>",
"<NSLayoutConstraint:0x174092ed0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x17418af80(375)]>",
"<NSLayoutConstraint:0x174092f20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x17418af80(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>
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 actually solved the problem changing the priority from the bottom of the image constrain to 750. Thanks for the help.

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