views:

55

answers:

1

Hi,

I started using core data and I read that I can save the data using the managedObjectContext "save" function.

However, I noticed that when I fetch records from my store (sqlite db), even if I change my managed object without saving, and I reload my view , the new data is loaded. (In my viewWillAppear I fetch the data all over again from the store).

So if there some automatic saving going on under the hood ? and if that's the case when should I use the "save" function.

Thanks

+2  A: 

Modifications are maintained in-memory for the life of your application. Save commits outstanding changes to the persistent store. You must save for changes to persist between app launches. Explicitly calling save allows you to reduce memory consumption, distribute disk writes, and verify the integrity of your data. All of this comes at the expense of a trip to your persistent store.

Justin