Core Data NSFetchedResultsController sorting in certain sequence

Posted by Moze on Stack Overflow See other posts from Stack Overflow or by Moze
Published on 2010-05-17T18:08:19Z Indexed on 2010/05/17 18:10 UTC
Read the original article Hit count: 209

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.

© Stack Overflow or respective owner

Related posts about xcode

Related posts about iphone-sdk