-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on NSLayoutConstraint.autoSetPriority #208
Comments
Could you show us an example of where you're trying to set the priority of the constraint on the |
I have too many layers to paste the whole thing so I am going to explain: I have a
in the initializer of those views (View1, 2, 3, 4 etc..) I have the So ideally
dequeues a cell for the first time, hence initializing it. Now note that I am setting priority 900. I am using the The priority of 900 is made on purpose so that the stackView is free to add and remove these constrains without conflicting with the views internal constrains, but having a priority of them (and hiding/showing them correctly without triggering warnings) This works fine most of the time, and I get no warning for unstatisfaiable constrains in console. However this crashes the app, if the Some of the views I showed above (View1 for example) is a horizontal collectionView that is used to make a carousel in the table view cell. Setting the vertical dimension of the collection view crashes the app with the stacktrace above |
Understandable at what you're trying to achieve as it makes sense. Taking a look at the stack trace, an exception is being thrown at the |
Yes, that is correct. I had however had to remove PureLayout constrains else the crash was still happening. Without the autoSetDimension the crashes are not there, but I have a million warning due to StackView fighting to have height = 0 @1000 and intrinsicContentSize pushing for a random number @1000 That is why I was wondering if wrapping the constrains of PureLayout into a autoSetPriority |
When calls are made through the |
Cool! Thanks! I am sorry I cannot provide the code, but it is a company one. |
Hello,
using
NSLayoutConstraint.autoSetPriority(.init(rawValue: 900)) {}
to setup some constrains with a specific priority makes the application crash if the constrains are set on a CollectionView.
Remving the autoSetPriority makes the app stop crashing
The text was updated successfully, but these errors were encountered: