我不明白问题,但我想故事板中的问题(在我的约束中,因为有时候对象不是他们必须的地方)。
*由于未捕获的异常'NSGenericException'而终止应用,原因:'*
Collection <__NSSetM: 0x7fae0b5e6900> was mutated while being enumerated.'
*** First throw call stack:
- (
0 CoreFoundation __exceptionPreprocess + 165
1 libobjc.A.dylib objc_exception_throw + 45
2 CoreFoundation __NSFastEnumerationMutationHandler + 132
3 Foundation -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 336
4 Foundation -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 330
5 Foundation -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 314
6 Foundation -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 285
7 Foundation -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 691
8 Foundation -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 275
9 Foundation -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 220
10 UIKit -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 411
11 UIKit -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:] + 30
12 UIKit [UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 243
13 UIKit -[UIView(UIConstraintBasedLayout) addConstraints:]_block_invoke + 188
14 Foundation [NSISEngine withBehaviors:performModifications:] + 155
15 UIKit [UIView(UIConstraintBasedLayout) addConstraints:] + 263
16 UIKit-[UIView _setTraitStorageConstraints:] + 794
答案 0 :(得分:1)
这不是自动布局的问题。您正在使用数组或字典或某些NSSet对象变异(正在添加值),而枚举(正在从中读取值)。< / p>
当您填充类似数组的内容然后重新加载UITableView
或UICollectionView
答案 1 :(得分:0)
也许其他一些后台线程和主线程同时调用autolayout函数。查看崩溃日志中的其他线程。