Re: Resolving bizarre autolayout crashes.
Re: Resolving bizarre autolayout crashes.
- Subject: Re: Resolving bizarre autolayout crashes.
- From: Ben Kennedy <email@hidden>
- Date: Wed, 04 Feb 2015 14:39:03 -0800
On 04 Feb 2015, at 1:08 pm, Alex Zavatone <email@hidden> wrote:
> Thanks Kyle. The thing that scares me here is that I have no idea why this started failing and why it stopped, so I'm afraid it could stop working at any time without knowing why.
Kyle already gave you a likely reason: you have a height constraint on the scroll view which conflicts with other constraints under some circumstances.
> I think this started happening when I changed device size in the simulator, or dragged the simulator from one screen to another but still, I'm unsure what caused it to start throwing an exception.
To be clear, the exception is thrown because your scroll view has two or more conflicting constraints in force.
Here again are the constraints from the debugging output you posted earlier:
"<NSLayoutConstraint:0x16d8e230 V:[UIScrollView:0x16d8df50(>=1368)]>",
"<NSLayoutConstraint:0x16d8f7e0 V:|-(0)-[UIScrollView:0x16d8df50] (Names: '|':UIView:0x16d8f650 )>",
"<NSLayoutConstraint:0x16d8f810 V:[UIScrollView:0x16d8df50]-(0)-| (Names: '|':UIView:0x16d8f650 )>",
"<NSAutoresizingMaskLayoutConstraint:0x173556e0 h=-&- v=-&- UIView:0x16d8f650.height == _UIParallaxDimmingView:0x14e396d0.height>",
"<NSAutoresizingMaskLayoutConstraint:0x17355f60 h=--& v=--& V:[_UIParallaxDimmingView:0x14e396d0(568)]>"
These state that the scroll view is pinned to the same frame as its superview, and that its height (and therefore its superview's height) must be >= 1368. However, there is also a _UIParallaxDimmingView that is constrained also to occupy the same superview, but whose height is fixed at 568. Clearly, 568 < 1368; hence a conflict.
No doubt you aren't installing this _UIParallaxDimmingView yourself, but some interaction is prompting UIKit to do so (presumably on a transient basis). While I don't know anything about such circumstances, it seems to follow that if you take Kyle's advice and remove the height constraint on the scroll view, it will prevent such a conflict.
b
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden