ios遍历数组时crash

forin 报错

*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x146784f00> was mutated while being enumerated.’

原因:遍历数组的同时,在改变该数组的元素所致。

解决:在外部重新创建一个NSMutableArray

你可能感兴趣的:(ios遍历数组时crash)