当我创建新版本的Core Data Model然后重新启动应用程序时,我收到此崩溃日志:
*** - [NSRelationshipDescription name]:发送到解除分配的实例0x1d032e240的消息
似乎模型迁移不起作用,而我使用NSMigratePersistentStoresAutomaticallyOption
和NSInferMappingModelAutomaticallyOption
商店选项......
有人可以帮助我吗?
谢谢!
编辑:我对我的模型所做的更改只是向存在的实体添加了一个新属性(布尔为NSNumber)
编辑:这是核心数据初始化代码:
- (BOOL) loadCatalog
{
// Unload any existing store
[self _unloadCurrentStore];
// Create a new managed object context
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
_managedObjectContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;
_managedObjectContext.persistentStoreCoordinator = _persistentStoreCoordinator;
// Create the persistent store
NSURL *storeURL = [[AppDelegate sharedDelegate].catalogDirectoryURL URLByAppendingPathComponent:@"Store.sqlite"];
NSDictionary *storeOptions = @{ NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES };
return ([_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:storeOptions error:nil] != nil);
}