I have a set of core data items that I want to sort based on a numeric attribute that I have set to Integer 16. It's just a list of things that have a custom sort so I've added an 'ordering' integer so that I can say abc->1 cba->2 aaa->3 etc. I want to sort using the 1,2,3 and display the key (which is another attribute).
I can't figure out how to do this, I'm guessing I need to change the selector but I don't know what to do.
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"ordering" ascending:YES selector:@selector(localizedStandardCompare:)]];
The error I get is
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber localizedStandardCompare:]: unrecognized selector sent to instance 0x8142450'
I am creating the core data attribute like this:
dataItemOne.ordering = [NSNumber numberWithInteger:1];