Skip to content

Instantly share code, notes, and snippets.

@liamnichols
Created October 1, 2013 09:57
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/6776218 to your computer and use it in GitHub Desktop.
Save liamnichols/6776218 to your computer and use it in GitHub Desktop.
//Pull all the policy option hash's into memory
NSManagedObjectContext *managedObjectContext = [[SalesManager sharedSalesManager] managedObjectContext];
NSExpressionDescription* objectIdDesc = [NSExpressionDescription new];
objectIdDesc.name = @"objectID";
objectIdDesc.expression = [NSExpression expressionForEvaluatedObject];
objectIdDesc.expressionResultType = NSObjectIDAttributeType;
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:[ExtraPrice entityName]];
search.resultType = NSDictionaryResultType;
search.returnsDistinctResults = YES;
search.propertiesToFetch = @[ @"extraHash", objectIdDesc ];
NSArray *allHashes = [managedObjectContext executeFetchRequest:search error:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment