SnapKit: Crash when removing constraints on iOS 9
New Issue Checklist
🚫 If this template is not filled out your issue will be closed with no comment. 🚫
- I have looked at the Documentation
- I have read the F.A.Q.
- I have filled out this issue template.
Issue Info
| Info | Value |
|---|---|
| Platform | iOS |
| Platform Version | 9.3 |
| SnapKit Version | 0.22.0 |
| Integration Method | cocoapods |
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:
view.snp_removeConstraints()
view.snp_makeConstraints { (make) in
...
}
or:
view.snp_remakeConstraints { (make) in
...
}
It always crashes when trying to remove the constraints. The crash happens in Constraint.swift in uninstallFromView(). The crash occurs in the following block of code:
// remove the constraints from the UIView's storage
#if SNAPKIT_DEPLOYMENT_LEGACY && !os(OSX)
if #available(iOS 8.0, *) {
NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints)
} else if let installedOnView = installInfo.view {
installedOnView.removeConstraints(installedLayoutConstraints)
}
#else
NSLayoutConstraint.deactivateConstraints(installedLayoutConstraints) // < -- *** This line ***
#endif
Is this an issue in the iOS SDK or perhaps an issue in SnapKit? Any help would be appreciated.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
I have a very similar case here. (Xcode8.1 on iPhone6plus with iOS10)
The error msg is (no detailed error message): “libc++abi.dylib: terminating with uncaught exception of type NSException”, which happened when rotating device. The tracetree is shown as below
update: this crash happened more frequently if the method of remakeConstraints is called frequently like 10 times per seconds