0
votes

I have a bunch of code that sets Core Data relationships via the inverse instead of the "addWhateverObject" methods. This usually works well in all of my applications, but I have one app where the relationships are being lost when the NSManagedObject context is being saved.

My question is setting a relationship in Core Data via the relationship's inverse valid or do you have to use the accessor methods to add objects to the relationship?

Thanks!

1

1 Answers

1
votes

Yes, using the inverse is valid. Core data does all of the appropriate updating for you when you do that. See the comments on this question Core Data To-Many Relationship Creating Duplicates When Adding Object to Parent Entity