Skip to content

Instantly share code, notes, and snippets.

@liamnichols
Created December 13, 2013 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamnichols/7942200 to your computer and use it in GitHub Desktop.
Save liamnichols/7942200 to your computer and use it in GitHub Desktop.
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:@"<<ENTITY NAME>>"];
search.resultType = NSDictionaryResultType;
search.returnsDistinctResults = YES;
search.propertiesToFetch = @[ @"<<ID KEY>>" ];
NSArray *results = [managedObjectContext executeFetchRequest:search error:nil];
NSSet *allIDs = [NSSet setWithArray:[results valueForKeyPath:@"<<ID KEY>>"]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment