What does [context save:&err] actually do?


Let’s say I have three arrays within BNRItemStore from a previous challenge exercise. In the new CoreData code, I never actually specify the array of BNRItems that I want to save, I only create a model that reads in the HomePwner.xcdatamodeld file.

Does this mean that, when I call [context save:&err], the context will just look for all BNRItems that the BNRItemStore is pointing to and save them?

And when I extract it, will it just dump the content of the three separate arrays into one singular array?


Basically, Core Data knows what objects it has handed out and watches them. When you ask the context to save, it looks at all of those objects and sees if there are any changes. If there are, they are saved.