I want to create an NSFetchRequest
for objects like this:
The Object
is Car
which has an attribute
color
try this one:
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Cars"];
NSArray *arrayValues = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
if (arrayValues.count != 0) {
NSDictionary *result = [NSDictionary dictionaryWithObjects:arrayValues
forKeys:[arrayValues valueForKey:@"color"]];
return [result allValues];
}