简体   繁体   中英

Iphone Core data - automatic saving or not?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM