I have a Product managed object, and it has a one-to-many relationship with a Department managed object.
product 1 --- dept 1 dept 3 dept 4
departments.departmentId is or should be the KVC path to it. departments is an NSSet property on the Product MO, (and a relationship-with-an-inverse in the object model) and departmentId is a string.
Have I got my predicate’s KVC syntax wrong somehow?
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"Product" inManagedObjectContext:moc]; [fetchRequest setEntity:entityDescription]; NSPredicate *predicate = [NSPredicate predicateWithFormat: @"departments.departmentId == '100011'"]; [ fetchRequest setPredicate:predicate]; NSArray *array = [self.managedObjectContext executeFetchRequest: fetchRequest error:&_cd_error];
exception triggered by fetchRequest here “to-many relationship not allowed here” NSException
Can anyone tell me what is going on here? Fast? :-)