I have an entity mainEntity with three one-to-many relations to three different entities entity1, entity2 and entity3 (relations are named after objects they're referring to).
entity mainEntity
attribute name
relation entity1
relation entity2
relation entity3
These three entities have one-to-many reverse relations to this mainEntity (all the same, here's the example of first).
entity entity1
attribute name
relation mainEntity
So overall it's three many-to-many relations going from one mainEntity.
Now I need to set the three relations of mainEntity to object1, object2 and object3, which are instances of entity1, entity2 and entity3.
I can't do this:
MainEntity *myEntity = (MainEntity *)[NSEntityDescription
insertNewObjectForEntityForName:@"myEntity" inManagedObjectContext:context];
[myEntity setEntity1:object1];
[myEntity setEntity2:object2];
[myEntity setEntity3:object3];
Console says: Unacceptable type of value for to-many relationship: property = "entity1"; desired type = NSSet;
How to set them properly?