I have dates stored in core data as NSDate objects. When i try to retrieve them using a fetch request and -(id)valueForKey: i get an integer instead of an NSDate object.
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];
NSManagedObject *entity = [results lastObject];
NSDate *date = [entity valueForKey:@"updated"];
When i use dot notation such as myEntity.updated i get an NSDate object correctly but not when i use a KVC method.
The reason I want to use -(id)valueForKey: is because i am running this code on every entity in core data and I don't want to define each entity explicitly. Alternativly i could code a bunch of if statements that test for isKindOfClass, but that will require a lot of code and seems kind of hackish.
Any suggestions would be much appreciated.