【发布时间】:2011-10-24 05:52:04
【问题描述】:
从服务器获取一些数据时出现以下错误。在获取数据时,我正在显示带有活动指示器的自定义警报视图。警报正在使用主线程,而数据获取由 NSThread 完成。此问题仅在某个时间发生,并非总是如此。我不明白该怎么做。
* 由于未捕获的异常“NSGenericException”而终止应用程序,原因:“* 集合在被枚举时发生了变异。( "", "", “” )'
* 首次抛出时调用堆栈: (
0 CoreFoundation 0x00f2abe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0107f5c2 objc_exception_throw + 47
2 CoreFoundation 0x00f2a6a9 __NSFastEnumerationMutationHandler + 377
3 UIKit 0x00371b8e -[UIView(Hierarchy) _findFirstSubviewWantingToBecomeFirstResponder] + 189
4 UIKit 0x00366a13 -[UIView(Hierarchy) _promoteDescendantToFirstResponderIfNecessary] + 42
5 MyApplnName 0x00015154 -[SecondViewController getDataFromServer] + 1798
6 Foundation 0x000a1d4c -[NSThread main] + 81
7 Foundation 0x000a1cd8 __NSThread__main__ + 1387
8 libSystem.B.dylib 0x928db7fd _pthread_start + 345
9 libSystem.B.dylib 0x928db682 thread_start + 34
)
在抛出 'NSException' 实例后调用终止
【问题讨论】:
-
我不是 Objective-C 专家,但是通过查看错误消息,我想问:在您的代码中,您是否在执行类似
foreach item in collection的操作,同时修改了循环体?
标签: iphone nsexception nserror