I have 2 NSManagedObjects entities: VNSource <*–> VNDataChart (using a SQLite backend iOS).
After some user’s activities I have NSArray with selected Charts – listChartToDownload (contains VNDataChart objects).
I want to build predicate to filter all records in VNSource according objects in listChartToDownload.
I was successful with result array of VNSource objects by iterating fetch request for each objects in listChartToDownload. But it seems to me that you have more effective way.
I try execute this code below, but result is false – only one VNSource-object in arrayRequest (should be > 30).
Could you explane my mistakes?
NSFetchRequest *localRequest = [[NSFetchRequest alloc] init];
localRequest.entity = [NSEntityDescription entityForName:@"VNSource" inManagedObjectContext:context];
localRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"resolution" ascending:YES]];
localRequest.predicate = [NSPredicate predicateWithFormat:@"whichChart = %@" argumentArray: listChartToDownload];
localRequest.fetchBatchSize = 100;
arrayRequest = [context executeFetchRequest:localRequest error:&error1];
[localRequest release];
From what I understood about your question, you should probably be using
whichChart IN %@instead ofwhichChart = %@.And also, you should probably just be doing: