Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 与“碰撞”;收集在被列举时发生变异;_Ios_Ios5 - Fatal编程技术网

Ios 与“碰撞”;收集在被列举时发生变异;

Ios 与“碰撞”;收集在被列举时发生变异;,ios,ios5,Ios,Ios5,在崩溃后,我出现了以下错误: malloc: *** error for object 0x75617b4: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug 2013-02-05 19:15:44.950 BusinessIdea[3171:15e03] *** Term

在崩溃后,我出现了以下错误:

malloc: *** error for object 0x75617b4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
2013-02-05 19:15:44.950 BusinessIdea[3171:15e03] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSSetM: 0x72dc5c0> was mutated while being enumerated.'
malloc:**对象0x75617b4的错误:已释放对象的校验和不正确-对象可能在被释放后被修改。
***在malloc\u error\u break中设置断点以进行调试
2013-02-05 19:15:44.950 BusinessIdea[3171:15e03]***由于未捕获的异常“NSGenericeException”而终止应用程序,原因:“***集合在枚举时发生了变异。”

我不熟悉这个错误。知道它可能是什么吗?

整个“枚举时修改”错误意味着您可能试图在对集合进行迭代时从集合中删除某些内容。比如说

for(NSString *str in array){
     if([str isequalToString:@"delete me"]){
         [array removeObject:str];   //this will cause a problem,
     }
}   
如果要使用快速枚举循环,则需要生成要删除的项的列表,然后在迭代步骤后删除它们。如果要删除循环体中的项,可以使用传统的索引for循环