I am working on improving an existing application for using iCloud so that they can access the same data on multiple devices.
I plan to use document-based storage and use a package of files (i.e. a directory of files presented as a single file and processed by NSFileWrapper ).
My main question is: are package file updates guaranteed to be atomic? If I open the application and several files in one package of documents are changed, iOS will say them and then report about my application only when all the subfiles are present and in place? Or is there a risk that the files will appear one after another, leaving me a potentially inconsistent package?
In addition, my existing application uses SQLite (not through Core Data, but through a custom shell). Some parts of the application clearly require a good indexed SQL database for performance. So my plan is to use iCloud data as a link store, store the SQLite database in the Caches directory for performance reasons (or somewhere else strictly local to the device) and update the database based on what is in iCloud. Changes made by the user to the application will be recorded both in iCloud and in the local database. Is it crazy or sensible?
source share