First of all I'm using MagicalRecord to manage my Core Data. So right now my database layer works just great and it saves changes every time the change occurs. For example: I'm adding a new entry to a table and it gets written to db file stored on my hard disc right away. What I want to achieve is to keep all the changes in-memory, and write them to db file only on "save" command click.
I figured that the call that does the db file writing is:
[managedObjectContext MR_saveToPersistentStoreAndWait];
So as I figured, I can do all my modifications without calling that method, and then on "save" click, call that method. However, it works only if the thread wasn't changed. Every time, the thread changes the ManagedObjectContext gets reset or recreated, and I lose all my data.
EDIT: just found method in Magical Record:
[NSPersistentStoreCoordinator MR_coordinatorWithInMemoryStore];
which is what I need for the first part of my problem. Although, I don't know how to change from that type of the coordinator to
[NSPersistentStoreCoordinator MR_coordinatorWithSqliteStoreNamed:objectModelName];
without losing any data.
Does anyone know how to do this right?! Any kind of help is really appreciated!