issue with Lightweight migration Coredata
Opened this issue · 0 comments
StevenAppJob commented
When I do lightWeight I get the error: NSSQLiteErrorDomain" - code: 1
Is there any workaround with this?
if ([[options objectForKey:NSMigratePersistentStoresAutomaticallyOption] boolValue] &&
[[options objectForKey:NSInferMappingModelAutomaticallyOption] boolValue]) {
NSMutableArray *bundles = [NSMutableArray array];
[bundles addObjectsFromArray:[NSBundle allBundles]];
NSManagedObjectModel *oldModel = [NSManagedObjectModel
mergedModelFromBundles:bundles
forStoreMetadata:metadata];
NSManagedObjectModel *newModel = [[self persistentStoreCoordinator] managedObjectModel];
if (oldModel && newModel) {
if (![oldModel isEqual:newModel]) {
// run migrations
if (![self migrateFromModel:oldModel toModel:newModel error:error]) {
return NO;
}
if I add [bundles addObjectsFromArray:[NSBundle allFrameworks]];
I get the value of oldModel nil.
instead adding only [bundles addObjectsFromArray:[NSBundle allBundles]];
it gives error when doing migrateFromModel : NSSQLiteErrorDomain" - code: 1.