[英]Core data migration issue - Its crashing the application
I have used cord data in my application, its already uploaded and live on app store. 我在应用程序中使用了数据线,该数据已经上传并可以在应用程序商店中使用。 Now I want to upload a new version with some changes in core data but application is crashing with following error - 现在,我要上传一个新版本,其中核心数据有所更改,但是应用程序崩溃并出现以下错误-
reason = "Can't find model for source store";
My code is already having atomic migration here is the code 我的代码已经有原子迁移,这是代码
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc]
initWithManagedObjectModel:[self managedObjectModel]];
if(![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil URL:storeUrl options:options error:&error])
I read the apple documentation and try to use 我阅读了苹果文档并尝试使用
- (BOOL)migrateStore:(NSURL *)storeURL toVersionTwoStore:(NSURL *)dstStoreURL error:(NSError **)outError
But how I find destination and source StoreURL here? 但是,我如何在这里找到目的地和来源StoreURL? From where should I call this method? 我应该从哪里调用此方法? And how? 如何?
Please give some suggestions to solve this problem. 请提出一些解决此问题的建议。
I have solved this problem with the help of this tutorial. 我已经在本教程的帮助下解决了这个问题。
http://code.tutsplus.com/tutorials/core-data-from-scratch-migrations--cms-21844 http://code.tutsplus.com/tutorials/core-data-from-scratch-migrations--cms-21844
Worth reading... :) Enjoy 值得一读... :)享受
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.