Skip to content

issue with Lightweight migration Coredata  #341

@StevenAppJob

Description

@StevenAppJob

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions