Skip to content

Instantly share code, notes, and snippets.

@hiddenmemory
Created February 2, 2012 16:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiddenmemory/1724518 to your computer and use it in GitHub Desktop.
Save hiddenmemory/1724518 to your computer and use it in GitHub Desktop.
SELECT name FROM SomeObject WHERE type = 'static' GROUP BY name [iOS5 Core Data ARC Remix]
- (NSArray*)listOfNames {
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"SomeObject" inManagedObjectContext:self.managedObjectContext]];
[request setResultType:NSDictionaryResultType];
[request setPropertiesToFetch:[NSArray arrayWithObject:@"name"]];
[request setPropertiesToGroupBy:[NSArray arrayWithObject:@"name"]];
[request setPredicate:[NSPredicate predicateWithFormat:@"type = %@", @"static"]];
return [self.managedObjectContext executeFetchRequest:request error:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment