On the process of updating an app to a newer version I am facing a problem related to Core-Data.
On the old version of the app, there is “theDB.sqlite” file. On the new version of the app, there are “theDB.sqlite”, “theDB.sqlite-shm” and “theDB.sqlite-wal” files instead.
Both versions work fine independently.
An issue arrises when a user has been using the old version for a while and makes an upgrade to the new version. I get a crash when the Core-Data DB is accessed.
I suppose I am doing something wrong in this method:
- (NSPersistentStoreCoordinator*)persistentStoreCoordinator
This code is probably not right:
NSPersistentStore *thePersistentStore = [persistentStoreCoordinator
addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:nil
error:&error];
But though I have tried many things, inspired by what I could find on the net, I can’t make it work.
I guess I could ask the user (as soon as I detect the problem in the app) to remove the old version before installing the new one. But if I can have a better solution, I want to avoid this kind of practice.
Aucun commentaire:
Enregistrer un commentaire