I am trying to copy a Core Data object, and striving to follow the example code you provide in Chapter 9, Section 9.5. After reading the chapter there is still something unclear. Will you please better explain why in the -associateObject: parent: method you treat objects belonging to the RecipeIngredient entity differently from all of the others? Is the “name” property the only reason for doing this?
What I need to fully understand, is how to behave correctly in the general case. In my Entity there are some relationships, some of them are to-one, others are to-many. Some entities have the “name” properties”, many don’t. I just have a few relationships in total. Should I simply treat each one as you treat RecipeIngredient in the -associateObject: parent: method?
In practice, quoting the book it is not clear why “If we are working with a RecipeIngredient then we know to just blindly create a new object. However, for any other object, we need to first check to see if it already exists in the NSManagedObjectContext.”