Prepopulated Core Data SQL store with new Write-Ahead Log (WAL) journaling

╄→尐↘猪︶ㄣ 提交于 2019-12-07 18:02:27

To force SQLite to make a checkpoint, execute PRAGMA wal_checkpoint.

Alternatively, ship the database with journal_mode = DELETE, and change the mode after the file has been installed.

In any case, there is no problem with just shipping all files. (The -shm file does not contain permanent data and could be ignored.)

You don't have to use WAL, that's just the default. You can switch to a different mode. When adding the persistent store, set the options argument to something like

NSDictionary *options = @{ @"journal_mode": @"DELETE" };

Then you'll get the same journal behavior as in earlier versions of iOS. Use this when creating your pre-populated data store and you won't need to deal with the extra journal files.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!