我有一个coredata表我想搜索NSMutable数组数据。这是我的可变数组数据,使用这个数据想找出相应的id,major,minor,uuid都有对应的id。所以在数组中我有5个数据所以5个数据有相应的5个不同的id如何反复这个:
{
major = 1;
minor = 6000;
uuid = "wwwwwwww";
},
{
major = 1;
minor = 4541;
uuid = "eeeeee";
},
使用此代码提取但应用程序崩溃
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"DatabeaconBasket" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"major IN %@", self.beaconListArray];
[fetchRequest setPredicate:predicate];
NSError *error = nil;
NSArray *result = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
if (error) {
NSLog(@"Unable to execute fetch request.");
NSLog(@"%@, %@", error, error.localizedDescription);
} else {
NSLog(@"%@", result);
}