2
There is the concept of Transaction and Commit in Core Data?
I have a database in the app that is fed by an external file, but it is a lot of data and the application takes around 2 minutes to perform this import so I need to run it in the background.
Is there any way to start a transaction when I start importing (delete all old data and insert new data) and commit when finished?
Since it is possible to use the app while the import is being performed, it is possible that access to some data has been deleted and this crashes the app (so I need to perform in a transaction).
An alternative I thought is to create a database cache if it is not possible to do Transaction and Commit.
Kick: the beginUndoGrouping and endUndoGrouping methods would not solve your problem? (the undo method serves to actually rollback in case of failure.) http://stackoverflow.com/questions/9733233/ios-core-data-how-to-implement-the-sql-transaction-function
– epx
Which method do you use to copy the data, GET or POST? if possible by code.
– William Monteiro
@Williammonteiro in what the method used matters? My problem is only with Core Data, but from what I saw here just save the context only after finishing the full import and not every Insert/delete. I’ll test that yet and if you solve I’ll close the question.
– Luis Henrique