I'm working on an iPhone and I'm using Core Data as my store.
What I'd like to do is list the top 50 entities in descending order by their height.
I'm struggling to find out the syntax for the predicate.
First, go to the NSFetchRequest class reference.
Use the sort descriptor to your fetch request :
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)];
[request setSortDescriptors:[NSArray arrayWithObject:sort]];
And use the fetchLimit property
[request setFetchLimit:50];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With