Assuming that the entities are defined as in Core Data Detail View with relationship, the following code establishes a relationship between the two objects:
[routineEntityDetail setValue:routineEntity forKey:@"routineinfo"];
It sets the relationship pointer from routineEntityDetail
to routineEntity
.
Since routinedet
is the inverse relationship to routineinfo
, routineEntityDetail
is automatically added to the routinedet
relationship of routineEntity
.
This does not make sense:
[[routineEntityDetail valueForKey:@"name"] addObject:routineEntity];
And this looks OK:
[routineEntity setValue: info.name forKey:@"routinename"];
[routineEntityDetail setValue: info.details.muscle forKey:@"image"];