Core Data NSFetchedResultsController sorting in certain sequence
- by Moze
I'm writing iphone app that has UITableView and uses Core Data. Data in UITableView is shown using NSFetchedResultsController. I use NSPredicate operator "IN" to fetch only needed entries.
NSArray *filterArray = [NSArray arrayWithObjects:@"789", @"963", @"445", @"198", nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id IN %@", filterArray];
Now the problem is that I need to show entries in same sequence they are in filterArray. How can I do it? How I can create NSSortDescriptor that would sort all entries in that way? I tried without sort descriptor, but I get error that NSFetchedResultsController needs sortDescriptor to be set.