WeChat icon indicating copy to clipboard operation
WeChat copied to clipboard

点赞之后,再评论崩溃了,必现的。

Open coffeemao opened this issue 6 years ago • 5 comments

点赞之后增加了一行,在评论崩溃了,必现

coffeemao avatar Jan 29 '18 02:01 coffeemao

[momentItemViewModel.dataSource addObject:commentItemViewModel]; 这个数组在点赞之后变成了不可变熟组了,导致崩溃,没跟踪到哪里改变的。

coffeemao avatar Jan 29 '18 03:01 coffeemao

好的,已经定位到了错误位置,MHMomentItemViewModel.m 第223行代码导致的,笔者会火速修复该Bug

CoderMikeHe avatar Jan 29 '18 03:01 CoderMikeHe

if (self.dataSource) { [ops addObject:atti]; [ops addObjectsFromArray:self.dataSource]; self.dataSource = ops.mutableCopy;

            }else{
                self.dataSource = [NSMutableArray arrayWithArray:@[atti]];
            }

coffeemao avatar Jan 29 '18 04:01 coffeemao

嗯嗯 ,之前用的是不可变的,后面要做评论数据的时候,才改成不可变的。后面这里就忘记修正了。

CoderMikeHe avatar Jan 29 '18 04:01 CoderMikeHe

笔者这雷厉风行的劲,学习

coffeemao avatar Jan 29 '18 04:01 coffeemao