I have a data model with a parent and a child. A child object has many inverse relationships with its parent entity (a child can have multiple parents). I am currently trying to get the number of parents of a specific child:
Parent *doomedParent = [self.fetchedResultsController objectAtIndexPath:indexPath];
Child *child = [doomedParent valueForKey:@"child"];
int parentCount = [[child valueForKey:@"parents.@count"] intValue];
When I try to count the parents (parental relationship) from the child, I get the following error:
'Termination of the application due to the unannounced exception "NSUnknownKeyException", reason: "[valueForUndefinedKey:]: Child entity is not a key value compatible with the encoding for the key" parents. @count ". '
Any ideas what I can do wrong?
source
share