2012-05-18 17:17:52.990 Untitled[982:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x615c6a0> was mutated while being enumerated.(
{
img = "GunKing.png";
name = "\U67aa\U738b\U4e4b\U738b";
time = "01:30:20";
},
{
img = "panda.png";
name = "\U529f\U592b\U718a\U732b";
time = "01:50:50";
},
{
img = "pary.png";
name = "\U5efa\U515a\U4f1f\U4e1a";
time = "02:11:00";
}
)'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fa55a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010f9313 objc_exception_throw + 44
2 CoreFoundation 0x00fa5069 __NSFastEnumerationMutationHandler + 377
3 CoreFoundation 0x00f0b1eb -[__NSFastEnumerationEnumerator nextObject] + 75
4 Untitled 0x000022c3 -[RootviewAppDelegate getDictonary:] + 288
5 Untitled 0x0000a6ba -[DetailsViewController collectButtonPress] + 386
6 UIKit 0x002d14fd -[UIApplication sendAction:to:from:forEvent:] + 119
7 UIKit 0x00361799 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x00363c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
9 UIKit 0x003627d8 -[UIControl touchesEnded:withEvent:] + 458
10 UIKit 0x002f5ded -[UIWindow _sendTouchesForEvent:] + 567
11 UIKit 0x002d6c37 -[UIApplication sendEvent:] + 447
12 UIKit 0x002dbf2e _UIApplicationHandleEvent + 7576
13 GraphicsServices 0x018fd992 PurpleEventCallback + 1550
14 CoreFoundation 0x00f86944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x00ee6cf7 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x00ee3f83 __CFRunLoopRun + 979
17 CoreFoundation 0x00ee3840 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00ee3761 CFRunLoopRunInMode + 97
19 GraphicsServices 0x018fc1c4 GSEventRunModal + 217
20 GraphicsServices 0x018fc289 GSEventRun + 115
21 UIKit 0x002dfc93 UIApplicationMain + 1160
22 Untitled 0x00002180 main + 102
23 Untitled 0x00002111 start + 53
)
terminate called after throwing an instance of 'NSException'if ([m_array count]!=0)
{
NSEnumerator *enumerator = [m_array objectEnumerator];
NSDictionary *testDic;
while ((testDic = [enumerator nextObject]))
{
if ([testDic isEqualToDictionary:m_dictionary])
{
continue;
}
else
{
[m_array addObject:m_dictionary];
}
}
enumerator = nil;
}
else
{
[m_array addObject:m_dictionary];
}
网上查了一下,是因为使用 NSEnumerator 不当导致。 难道是因为数组加了数据导致变更 ,使得地址越界?如果我想继续使用
NSEnumerator 达到一个遍历的效果,应该怎么修改。谢谢了
{
img = "GunKing.png";
name = "\U67aa\U738b\U4e4b\U738b";
time = "01:30:20";
},
{
img = "panda.png";
name = "\U529f\U592b\U718a\U732b";
time = "01:50:50";
},
{
img = "pary.png";
name = "\U5efa\U515a\U4f1f\U4e1a";
time = "02:11:00";
}
)'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fa55a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010f9313 objc_exception_throw + 44
2 CoreFoundation 0x00fa5069 __NSFastEnumerationMutationHandler + 377
3 CoreFoundation 0x00f0b1eb -[__NSFastEnumerationEnumerator nextObject] + 75
4 Untitled 0x000022c3 -[RootviewAppDelegate getDictonary:] + 288
5 Untitled 0x0000a6ba -[DetailsViewController collectButtonPress] + 386
6 UIKit 0x002d14fd -[UIApplication sendAction:to:from:forEvent:] + 119
7 UIKit 0x00361799 -[UIControl sendAction:to:forEvent:] + 67
8 UIKit 0x00363c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
9 UIKit 0x003627d8 -[UIControl touchesEnded:withEvent:] + 458
10 UIKit 0x002f5ded -[UIWindow _sendTouchesForEvent:] + 567
11 UIKit 0x002d6c37 -[UIApplication sendEvent:] + 447
12 UIKit 0x002dbf2e _UIApplicationHandleEvent + 7576
13 GraphicsServices 0x018fd992 PurpleEventCallback + 1550
14 CoreFoundation 0x00f86944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x00ee6cf7 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x00ee3f83 __CFRunLoopRun + 979
17 CoreFoundation 0x00ee3840 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x00ee3761 CFRunLoopRunInMode + 97
19 GraphicsServices 0x018fc1c4 GSEventRunModal + 217
20 GraphicsServices 0x018fc289 GSEventRun + 115
21 UIKit 0x002dfc93 UIApplicationMain + 1160
22 Untitled 0x00002180 main + 102
23 Untitled 0x00002111 start + 53
)
terminate called after throwing an instance of 'NSException'if ([m_array count]!=0)
{
NSEnumerator *enumerator = [m_array objectEnumerator];
NSDictionary *testDic;
while ((testDic = [enumerator nextObject]))
{
if ([testDic isEqualToDictionary:m_dictionary])
{
continue;
}
else
{
[m_array addObject:m_dictionary];
}
}
enumerator = nil;
}
else
{
[m_array addObject:m_dictionary];
}
网上查了一下,是因为使用 NSEnumerator 不当导致。 难道是因为数组加了数据导致变更 ,使得地址越界?如果我想继续使用
NSEnumerator 达到一个遍历的效果,应该怎么修改。谢谢了
解决方案 »
- 如何强制某个页面不能横竖屏切换?
- 急,现在等!mac os 安装完成后出现灰苹果,一直进不了登陆界面
- 看了论坛介绍IPHONE的开发环境的安装好复杂,但是专业的苹果论坛一直在介绍给普通的PC机器装苹果的系统,那直接装苹果的系统后,可以装开发环境?
- 在uitableview的每个cell上建立progress进度条,但是cell复用后进度条就回到初始化状态了,怎么解决这个问题
- UITextView问题,求大神解决。
- 求大牛推荐几本开发ios入门书籍,我想了解了解ios开发
- NSLog的实现定义求解~
- 更新Xcode7后真机不能调试了
- iOS下完整的创建单例的语法到底是什么
- ios与android如何通过WIFI进行文件传输
- 字符编码问题
- 关于NSGenericException-使用NSEnumerator
如果在遍历时 去修改 例如你的代码中 有 [m_array addObject:m_dictionary]; 这样的语句,可能就是导致异常的原因了。如果你一定要用 Enumerator遍历 而且要修改,可以再声明一个中间变量数组,等遍历结束后再对数据进行修改