I'm preparing an update for a Core Data based app for fixes with iOS 7. I use Xcode 5 and iOS 7 SDK GM. However I realized a different behavior of the persistent store (which is a UIManagedDocument
): Prior to iOS 7 builds there was only one file persistentStore
in the documents folder (sometimes there was a second one persistentStore-journal
).
In iOS 7 builds (clean installation) there are now three files for the persistent store:
persistentStore
persistentStore-wal
andpersistentStore-shm
Did Apple change the journal mode by default to WAL now? I wonder if there is an impact on my app (think of users how update from the last version)? Would it be best to disable WAL - and if so, how can I do this with iOS 7/UIManagedDocument
?
A persistent store is a repository in which managed objects may be stored. You can think of a persistent store as a database data file where individual records each hold the last-saved values of a managed object. Core Data offers three native file types for a persistent store: binary, XML, and SQLite.
Overview. After you create a data model file as described in Creating a Core Data Model, set up the classes that collaboratively support your app's model layer. These classes are referred to collectively as the Core Data stack.
Q: How many Managed Object Model, a Persistent Store Coordinator can have? We can have only one Persistent Store Coordinator for each model.
Data persistence means storing any type of data to disk so that the same data can be retrieved without being altered when the user opens the app next time. We are going to describe all the ways to store data locally in iOS apps.
Yes, Apple have changed the default journal mode to WAL for iOS7. You can specify the journal mode by adding the NSSQLitePragmasOption to the options when calling addPersistentStoreWithType:configuration:url:options:error. E.g. to set the previous default mode of DELETE:
NSDictionary *options = @{ NSSQLitePragmasOption : @{@"journal_mode" : @"DELETE"} };
In my experience WAL gives better performance, but also see this post:
iOS CoreData - are there any disadvantages to enabling sqlite WAL / Write-Ahead Logging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With