Reputation: 31
I don't understand problem, but I guess the problem in storyboard (In my constraints, because sometimes objects isn't where they must be).
* Terminating app due to uncaught exception 'NSGenericException', reason: '*
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
Upvotes: 2
Views: 5364
Reputation: 2218
Maybe some other background thread and main thread call autolayout functions simultaneously. Check out other threads in the crash log.
Upvotes: 1
Reputation: 4223
This isn't a problem with auto layouts. You are using an Array or Dictionary or some NSSet object which is being mutated (values are being added to it) while being enumerated (values are being read form it).
This problem mainly arises when you populate something like an Array and then reload a UITableView
or UICollectionView
Upvotes: 2