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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when removing constraints on iOS 9 #331
Comments
@SlayterDev can you please post the stack trace and/or exception info? |
Stack trace:
Exception: |
@SlayterDev does this crash happen everytime? EXEC_BAD_ACCESS is a memory violation but it looks like it's coming from inside UIKit. It could in theory be dealloc'd constraints getting passed into that function call. Just to be 100% sure your constraint code is always running on the main thread right? |
I would agree that it seems to be dealloc'd constraints being passed. But I'm not sure how they are being dealloc'd between that time. We have a few other places where we call remake but it still seems to work. My current fix is to rebuild the view from scratch and reassign necessary properties. It's still weird this only happens on iOS 9. |
@SlayterDev it seems fishy, no other reports of this yet. Is it something you can extract to a small sample project? |
Closing due to inactivity and inability to reproduce. |
I have a very similar case here. (Xcode8.1 on iPhone6plus with iOS10) The error msg is (no detailed error message): update: this crash happened more frequently if the method of remakeConstraints is called frequently like 10 times per seconds |
@wangbourne whats the actual exception info? ObjC messages normally contain lots of good info about what went wrong if you let them crash your app rather than breaking on them. |
Actually that's the only message i can see from Xcode (i didn't break on them :) ) |
@wangbourne objective-c exceptions should output stuff into a crash log or the console if they are uncaught and crash your app. From looks of this you have a breakpoint setup on "All Objective-C Exceptions" this breakpoint breaks even for exceptions that are caught, if you continue and you don't see any additional error messaging or a crash it's probably an exception that isn't important ( iOS is internally suppressing it ) |
i got above error message without any breakpoint, then i tried to find out the root cause, so i set breakpoint at exceptions, and got above screenshot. |
@wangbourne ah so you're getting an EXEC_BAD_ACCESS after it breaks? Any chance you have a small project that reproduces it easily? |
@robertjpayne hi robertjpayne, in our project I鈥榲e meet this crash. Also this crash only occur on iOS9. ---<UIView: 0x7fcc51cd29d0; frame = (-1 -1; 377 377); layer = <CALayer: 0x7fcc51dec2a0>> ---<UIView: 0x7fcc51cd29d0; frame = (-1 -1; 377 377); layer = <CALayer: 0x7fcc51dec2a0>> 2017-12-05 16:34:27.082 [41765:977382] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebsiteDataStore nsli_layoutEngine]: unrecognized selector sent to instance 0x7fcc5480c570' |
Experiencing the same issue. It happens in internal func deactivateIfNeeded() {
guard let item = self.from.layoutConstraintItem else {
print("WARNING: SnapKit failed to get from item from constraint. Deactivate will be a no-op.")
return
}
let layoutConstraints = self.layoutConstraints
NSLayoutConstraint.deactivate(layoutConstraints)
item.remove(constraints: [self])
} |
I had encounter the same crash. finally, I find that some of view's contrains is 0x0000000, it's nil. I change the time to use snp_removeConstraints() function. It worked. |
New Issue Checklist
馃毇 If this template is not filled out your issue will be closed with no comment. 馃毇
Issue Info
Issue Description
Since updating to Xcode 8, Swift 2.3, and SnapKit 0.22.0 we've been having an issue with removing constraints. We have a UIView that we need to change constraints for. Regardless if we are using:
or:
It always crashes when trying to remove the constraints. The crash happens in
Constraint.swift
inuninstallFromView()
. The crash occurs in the following block of code:Is this an issue in the iOS SDK or perhaps an issue in SnapKit? Any help would be appreciated.
The text was updated successfully, but these errors were encountered: