Using mergedModelFromBundles: and versioning (CoreData)

Posted by charlax on Stack Overflow See other posts from Stack Overflow or by charlax
Published on 2010-02-17T15:50:04Z Indexed on 2010/03/24 23:53 UTC
Read the original article Hit count: 435

Hi everybody,

I'm trying to use the migration feature in CoreData. I've followed the Apple Documentation. I have a problem in the following method:

/**
 Returns the managed object model for the application.
 If the model doesn't already exist, it is created by merging all of the models found in the application bundle.
 */
- (NSManagedObjectModel *)managedObjectModel {

    if (managedObjectModel != nil) {
        return managedObjectModel;
    }
    /* 
     * NSInvalidArgumentException', reason: '*** -[NSCFArray insertObject:atIndex:]: attempt to insert nil'
     * 2010-02-17 16:27:15.338 Patrimoine[3037:207]
     */ 
    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];    
    return managedObjectModel;
}

It appears that there is the same problem on http://iphonedevelopment.blogspot.com/2009/09/core-data-migration-problems.html

Yet I did choose the method Apple suggests, by using the menu option "Add Model Version".

Do you have any idea?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data