I want to save the content of a MOC
to a file myFile.ext
. Everything works well, my data is saved to the file BUT I have to auxiliary files in addition:
myFile.ext-wal
myFile.ext-shm
Are these files necessary for my purpose (saving the content of a MOC
to a file)? I would like to "ship" my data in only one file. Furthermore, when I get again my data, I only use the URL
of myFile.ext
.
If they are not necessary, is it possible to avoid their creation?
As CL indicated they are necessary in WAL mode. To disable the journaling mode when creating your persistent store pass the flowing option.
NSDictionary *options = @{NSSQLitePragmasOption: @{@"journal_mode": @"DELETE"};
_coordinator = [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&storeError];
When you run your app again the -wal should disappear and the -shm can be deleted or ignored. All you data should be in the one sqlite file.