Conflicting constraints on GIDSignInButton in Google Sign-In SDK 2.0.1 - ios

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.

Related

How to debug AutoLayout Constraints?

I am new to iOS Development. Whenever I run my App, I get this conflicting constraints error. Can you please suggest me something about how to debug this issue?
2016-07-13 12:53:51.186 Calculator[4458:50017] 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.
(
"<_UILayoutSupportConstraint:0x7fcaf3c5e670 V:[_UILayoutGuide:0x7fcaf3c62a80(0)]>",
"<_UILayoutSupportConstraint:0x7fcaf3c5c060 _UILayoutGuide:0x7fcaf3c62a80.bottom == UIView:0x7fcaf3c54390.bottom>",
"<NSLayoutConstraint:0x7fcaf3c54b00 UIImageView:0x7fcaf3c54c70.width == UIImageView:0x7fcaf3c54c70.height>",
"<NSLayoutConstraint:0x7fcaf3c633d0 V:|-(0)-[UIImageView:0x7fcaf3c54c70] (Names: '|':UIView:0x7fcaf3c54390 )>",
"<NSLayoutConstraint:0x7fcaf3c63420 H:[UIImageView:0x7fcaf3c54c70]-(0)-| (Names: '|':UIView:0x7fcaf3c54390 )>",
"<NSLayoutConstraint:0x7fcaf3c63470 H:|-(0)-[UIImageView:0x7fcaf3c54c70] (Names: '|':UIView:0x7fcaf3c54390 )>",
"<NSLayoutConstraint:0x7fcaf3c63560 V:[UIImageView:0x7fcaf3c54c70]-(0)-[_UILayoutGuide:0x7fcaf3c62a80]>",
"<NSLayoutConstraint:0x7fcaf3c67e50 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fcaf3c54390(736)]>",
"<NSLayoutConstraint:0x7fcaf3c61230 'UIView-Encapsulated-Layout-Width' H:[UIView:0x7fcaf3c54390(414)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fcaf3c54b00 UIImageView:0x7fcaf3c54c70.width == UIImageView:0x7fcaf3c54c70.height>
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.
It seems as if you have a constraint added which is being counter acted by another constraint.
Normally if you right click you're able to get the 'Suggested Constraints' try using them and see if it works!
edit:

Getting autolayout issues in debugger

Trying to get autolayout to work so that cell resizing can be achieved.
This is how my storyboard looks like:
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-06-01 14:05:24.587 BrandSpace[4968:1387945] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x1258c32a0 H:[LikeButton:0x1258c2d80'Like'(46)]>",
"<NSLayoutConstraint:0x1258c3830 H:[UILabel:0x1258c35d0'1'(121)]>",
"<NSLayoutConstraint:0x1258c4290 H:|-(8)-[LikeButton:0x1258c2d80'Like'] (Names: '|':UIView:0x1258bf6f0 )>",
"<NSLayoutConstraint:0x1258c4330 H:[LikeButton:0x1258c2d80'Like']-(387)-[UILabel:0x1258c35d0'1']>",
"<NSLayoutConstraint:0x1258c4380 H:[UILabel:0x1258c35d0'1']-(8)-| (Names: '|':UIView:0x1258bf6f0 )>",
"<NSLayoutConstraint:0x1258c47c0 H:[UIView:0x1258bf6f0]-(15)-| (Names: '|':UITableViewCellContentView:0x1258c1a50 )>",
"<NSLayoutConstraint:0x1258c4810 H:|-(15)-[UIView:0x1258bf6f0] (Names: '|':UITableViewCellContentView:0x1258c1a50 )>",
"<NSLayoutConstraint:0x1247fb850 'fittingSizeHTarget' H:[UITableViewCellContentView:0x1258c1a50(375)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1258c3830 H:[UILabel:0x1258c35d0'1'(121)]>

Unable to simultaneously satisfy constraints using Cordova

I get the following error on my Cordova application in XCode.
2016-03-22 19:59:11.063 HelloCordova[280:83910] 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:0x17dce400 h=--& v=--& V:[UIKeyboardAssistantBar:0x17e98840(0)]>",
"<NSLayoutConstraint:0x17eaf150 V:|-(0)-[_UIButtonBarStackView:0x17eaddf0] (Names: '|':UIKeyboardAssistantBar:0x17e98840 )>",
"<NSLayoutConstraint:0x17eaf190 V:[_UIButtonBarStackView:0x17eaddf0]-(0)-| (Names: '|':UIKeyboardAssistantBar:0x17e98840 )>",
"<NSLayoutConstraint:0x17dd5430 V:|-(0)-[_UIUCBKBSelectionBackground:0x17dd51c0] (Names: '|':_UIButtonBarButton:0x17dd46b0 )>",
"<NSLayoutConstraint:0x17dd54c0 _UIUCBKBSelectionBackground:0x17dd51c0.bottom == _UIButtonBarButton:0x17dd46b0.bottom>",
"<NSLayoutConstraint:0x17dd56a0 'UIButtonBar.maximumAlignmentSize' _UIButtonBarButton:0x17dd46b0.height == UILayoutGuide:0x17eae800'UIViewLayoutMarginsGuide'.height>",
"<NSLayoutConstraint:0x17eae8d0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x17eae800'UIViewLayoutMarginsGuide']-(3)-| (Names: '|':_UIButtonBarStackView:0x17eaddf0 )>",
"<NSLayoutConstraint:0x17eae870 'UIView-topMargin-guide-constraint' V:|-(10)-[UILayoutGuide:0x17eae800'UIViewLayoutMarginsGuide'] (Names: '|':_UIButtonBarStackView:0x17eaddf0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17dd54c0 _UIUCBKBSelectionBackground:0x17dd51c0.bottom == _UIButtonBarButton:0x17dd46b0.bottom>
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.
It's a brand new Cordova install today with the www folder replaced with an application I built a while back.
Where about would I need to look for more information on this?
Need any further information for debugging?
Thank you!

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.

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

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

Resources