NSMutableArray *booksArr = [NSMutableArray array];
for (Book *model in bookList) {
__block BOOL isExist = NO;
[booksArr enumerateObjectsUsingBlock:^(Book * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.sid == model.sid) {
*stop = YES;
isExist = YES;
}
}];
if (!isExist) {
[booksArr addObject:model];
}
}
网友评论