I used KVC
until now to access object's properties.
In my object i have a method like this:
-(Address *)mainAddress {
if (self.addresses != nil) {
return [self.addresses anyObject]; //stub method
}
else {
return nil;
}
}
I can use this method with KVC
using
mystring = [cliente valueForKeyPath:@"mainAddress.city"];
but i cannot use to create a NSFetchRequestController
(this code use MagicalRecord)
NSFetchedResultsController *acontroller = [Customer fetchAllSortedBy:@"mainAddress.city" ascending:ascending withPredicate:companyPredicate groupBy:nil delegate:self];
This is the error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath mainAddress.city not found in entity <NSSQLEntity Customer id=4>'