Reputation: 9063
Is there any way to tell the NSPersistentStoreCoordinator
to write all changes to the sqlite file?
We include a diagnostic function in our applications that allows the user to send us the sqlite database and some logs. In many cases the sqlite file included in the diagnostic upload does not represent the current state of the persistent objects of the application because the changes were not written into the file before uploading it.
I want to somehow tell CoreData to write the current state completely into the sqlite file before uploading it.
Upvotes: 0
Views: 65
Reputation: 70966
There's no specific API to tell NSPersistentContainer
or other Core Data classes to flush changes to the SQLite file. But that's probably not the problem. You mentioned in a comment that you're not uploading the SQLite journal files. That's pretty much a guarantee that you'll be missing data, maybe most of it. All of the files are needed to reconstruct the data. Without flushing data there's a slim chance that the most recent change might be missing, especially if you haven't saved changes. Without uploading the journals there's a near-guarantee of incomplete data.
Upvotes: 1