for循环报错 (was mutated while being enumerated.')

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

for (UseModel *m in weakSelf.clearItemArray) {

            if(m.parentID==model.parentID) {

                [weakSelf.clearItemArrayremoveObject:m];

                break;

            }

        }

添加break,使其跳出循环。

你可能感兴趣的:(for循环报错 (was mutated while being enumerated.'))