日期/时间:2018-10-30 00:57:35 +0000 作业系统版本:iPhone OS 12.0.1(16A404) 报告版本:104
Exception Type: SIGSEGV Exception Codes: SEGV_ACCERR at 0x10 Crashed Thread: 0
线程0崩溃:0 libobjc.A.dylib
0x00000001aa9f0d70 objc_msg发送+ 16 1基金会
0x00000001ac3c7958 NSLayoutConstraintIsPotentiallyDanglyInContainer + 112 2 UIKitCore 0x00000001d8b78464 -[UIView + 13431908(AdditionalLayoutSupport)_snipDangliesWithForce:repairIfPossibleForViewThatMoved:newSuperview:oldSuperview:] + 424 3 UIKitCore 0x00000001d8b781c8 _UIViewRemoveConstraintsMadeDanglyByChangingSuperview + 1088 4 UIKitCore 0x00000001d8c19f54 __45- [UIView + 14094164(层次结构)_postMovedFromSuperview:] _ block_invoke + 68 5
UIKitCore 0x00000001d8c19e74-[UIView + 14093940(层次结构)_postMovedFromSuperview:] + 756 6 UIKitCore
0x00000001d8c17f38 __UIViewWasRemovedFromSuperview + 172 7 UIKitCore 0x00000001d8c17a18-[UIView + 14084632(层次结构)removeFromSuperview] + 464我收到了这样的崩溃,只有ios12.0.1
答案 0 :(得分:1)
我的声誉还不够高,无法发表评论,但是我经历了同样的崩溃,这种崩溃只在iOS 12上才开始发生。我向Apple提交了错误报告,因此希望很快得到解决。
基于堆栈跟踪,它在尝试清除悬空约束时会崩溃,因此可以尝试的一种解决方法是在删除视图之前先删除所有约束。
extension UIView {
func removeAllConstraints() {
let superViewConstraints = superview?.constraints.filter{ $0.firstItem === self || $0.secondItem === self } ?? []
superview?.removeConstraints(superViewConstraints + constraints)
}
}
...然后在删除视图之前,只需调用:
view.removeAllConstraints()
我不确定100%会成功,因为我自己无法重现崩溃,我只是看到它在我使用的崩溃分析服务中弹出。