这是我的应用程序中的代码:
NSMutableArray *firstPhotoVoters = post.firstPhotoVoters;
NSMutableArray *secondPhotoVoters = post.secondPhotoVoters;
ALog(@"First voters: %@", firstPhotoVoters);
ALog(@"Second voters: %@", secondPhotoVoters);
for (Post* _post in posts) {
if ([_post.objectId isEqualToString:post.objectId]) {
[_post.firstPhotoVoters removeAllObjects];
[_post.secondPhotoVoters removeAllObjects];
ALog(@"Count: %d", firstPhotoVoters.count);
ALog(@"Updated post: %@", _post);
}
}
两个 ALog 语句(它是 NSLog 的宏)转储存在于 firstPhotoVoters 和 secondPhotoVoters 数组中的数组元素。但是,在 for 循环中,两个数组看起来都是空的。firstPhotoVoters.count 始终为零。我在这里想念什么?
谢谢你。