ItsASecret
ItsASecret

Reputation: 2649

CoreData add object to to-many relashionship

So I have CustomEntity1 and CustomEntity2 generated with mogenerator. CustomEntity1 have a to-many relashionship with CustomEntity2 and CustomEntity2 have a reverse relashionship to-one with CustomEntity1.

My question is when I add some CustomEntity2 to CustomEntity1 by doing :

[CustomEntity1 addCustomEntity2Object:entity2FreshlyCreated]

Does it set the inverse relashionship ? Or do I have to do this too ?

CustomEntity2.parent = CustomEntity1;

Upvotes: 0

Views: 141

Answers (1)

benzado
benzado

Reputation: 84338

The whole reason Core Data asks you to indicate an inverse relationship for an object is so that it can update it automatically. The lines you posted are equivalent.

Upvotes: 2

Related Questions