[报错]Fast enumeration variables cannot be modified in ARC by default; declare the variable __strong to allow this

今天在写一个for...in...循环的时候遇到报错如上,
for ( CourseItem *item in self.dataArray) {
item = [self cleanRepeatModel:item];
}

进过查找发现时快速枚举在ARC模式下不允许直接修改引用属性,需要在引用属性前面加上__strong来允许。如下,
for (__strong CourseItem *item in self.dataArray) {
item = [self cleanRepeatModel:item];
}

你可能感兴趣的:([报错]Fast enumeration variables cannot be modified in ARC by default; declare the variable __strong to allow this)