作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我不明白问题所在,但我猜是 Storyboard 中的问题(在我的限制下,因为有时对象不在它们必须在的位置)。
* 由于未捕获的异常“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
最佳答案
这不是自动布局的问题。您正在使用数组或字典或某些 NSSet 对象,这些对象在枚举(从中读取值)的同时被突变(值被添加到其中)。
这个问题主要出现在填充数组之类的东西然后重新加载 UITableView
或 UICollectionView
关于ios - 由于未捕获的异常 'NSGenericException' 而终止应用程序,原因 : '*** Collection <__NSSetM...> was mutated while being enumerated.' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31335026/
我不明白问题所在,但我猜是 Storyboard 中的问题(在我的限制下,因为有时对象不在它们必须在的位置)。 * 由于未捕获的异常“NSGenericException”而终止应用程序,原因:“*
我是一名优秀的程序员,十分优秀!