views:

40

answers:

1

Hi.

If a Core Data relationship has an inverse relationship do you only need to set one of the relationships objects then the corresponding relationship is setup?

In the past I have set both relationships but when looking at iPhone Core Data Recipes it seems they only set 1 of the relationships?

Thanks James

+1  A: 

I found the answer in the documentation:

Since Core Data takes care of the object graph consistency maintenance for you, you only need to change one end of a relationship and all other aspects are managed for you. This applies to to-one, to-many, and many-to-many relationships. Consider the following examples.

So the answer is YES you only need to set one side of the relationship.

More information here:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdRelationships.html#//apple_ref/doc/uid/TP40001857-CJBDBHCB

jodm