As Monolo said, you cannot use the comparator block with Core Data. However, you can use:
[NSSortDescriptor sortDescriptorWithKey:(NSString *) ascending:(BOOL) selector:(SEL)]
You will need to expand the model if you are not using a standard selector.
For example, I just needed to order the lines "a la Finder" (ie 1,2,9,10, not 1,10,2,9), and I used
request.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:myEntity ascending:NO selector:@selector(localizedStandardCompare:)]];
Take a look at Apple's NSSortDescriptor Class Link
Happy coding :)
Bruno belotti
source share