相关疑难解决方法(0)

使用mergedModelFromBundles:和版本控制(CoreData)

我正在尝试使用CoreData中的迁移功能.我已经关注了Apple文档.我在以下方法中遇到问题:

/**
 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;
}
Run Code Online (Sandbox Code Playgroud)

http://iphonedevelopment.blogspot.com/2009/09/core-data-migration-problems.html上似乎存在同样的问题

然而,我确实选择了Apple建议的方法,使用菜单选项"添加模型版本".

你有什么主意吗?

iphone core-data core-data-migration

11
推荐指数
2
解决办法
2万
查看次数

标签 统计

core-data ×1

core-data-migration ×1

iphone ×1