Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with Lightweight migration Coredata #341

Open
StevenAppJob opened this issue Jan 18, 2022 · 0 comments
Open

issue with Lightweight migration Coredata #341

StevenAppJob opened this issue Jan 18, 2022 · 0 comments

Comments

@StevenAppJob
Copy link

StevenAppJob commented Jan 18, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant