Last active
August 29, 2015 14:05
-
-
Save nicktoumpelis/cb59f9076cc009972b99 to your computer and use it in GitHub Desktop.
Core Data: Create a simple NSFetchRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSManagedObjectContext *managedObjectContext = ...; | |
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; | |
[fetchRequest setEntity:[NSEntityDescription entityForName:@"Entity" inManagedObjectContext:managedObjectContext]]; | |
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"..."]; | |
[fetchRequest setPredicate:predicate]; | |
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"key" ascending:YES]; | |
[fetchRequest setSortDescriptors:@[sortDescriptor]]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment