Pulley icon indicating copy to clipboard operation
Pulley copied to clipboard

autolayout constraint error

Open ovdm opened this issue 6 years ago • 4 comments

This issue has been reported before as #142 but was closed. I have this issue consistently, that is why I am opening a new issue.

[LayoutConstraints] 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:0x6000033c68f0 h=--& v=--& UIView:0x7f8d527c6f30.width == 0 (active)>", "<NSLayoutConstraint:0x60000333c140 UILayoutGuide:0x600002ad3aa0'UIViewSafeAreaLayoutGuide'.trailing >= UILabel:0x7f8d5d01c790.trailing + 10 (active)>",

I traced it down to a subview of 'drawerScollView' of type UIView having an NSAutoresizingMaskLayoutConstraint of CGSize.zero.

I am using PulleyViewController in 3 places. In all of them, it is the rootviewcontroller. This eliminates the solution suggested in #142 for me. All the Container views in used by PulleyViewController in my app are build with IB.

ovdm avatar Dec 13 '18 00:12 ovdm

Lower your constraint priority (whichever one is throwing log).

amyleecodes avatar Dec 13 '18 00:12 amyleecodes

Lowering priority is not solving any issue, it is just hiding a problem that will therefore not be solved.

magohamote avatar Jan 14 '19 16:01 magohamote

Lowering priority is a solution to an impossible layout created by your constrains not being okay starting with a CGRectZero frame.

It’s a perfectly acceptable and adequate solution for layouts that used fixed spacing.

amyleecodes avatar Jan 14 '19 17:01 amyleecodes

I had a similar problem as well, but this is just like @brendan09 said: set your constraints priorities to lower than the superview, but without messing up the hierarchy with other related views/constraints.

matuella avatar Feb 06 '19 21:02 matuella