Хочу сравнить изображения с двух NSArray.
Один массив, который я получал из базовой базы данных. Во-вторых, у меня есть постоянные объекты массива.
Я хочу знать, что объект второго массива присутствует в базе данных Core или нет.
Вот код, который я использовал.
// All object from core data and take into array.
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc]initWithEntityName:@"student"];
NSArray *dbresult = [[NSArray alloc]init];
NSError *error;
@try {
dbresult = [context executeFetchRequest:fetchRequest error:&error];
}
@catch (NSException *exception) {
NSString *logerror = [NSString stringWithFormat:@"error in fetching Rooms from coredata = %@",exception.description];
NSLog(logerror)
}
@finally {
}
/*
Get Unused images from list
*/
NSMutableArray *usedImages = [dbresult valueForKey:@"roomImageLocalPath"];
NSMutableSet *fSet = [NSMutableSet setWithArray:usedImages];
NSMutableSet *sSet = [NSMutableSet setWithCapacity:[newImages count]];
[sSet addObjectsFromArray:newImages];
[sSet minusSet:fSet];
NSArray *unusedImages = [secondSet allObjects];
NSLog(@"unusedImages %@",unusedImages);