core-data-migration

Core Data 'File “Contents” couldn't be opened'

心已入冬 提交于 2020-01-15 04:12:07
问题 I made the silly mistake and I accidentially touch my current Core Data model instead the new version one I just created. So I went to source control and reverted the changes inside the **.xcdatamodeld group. However I have now a zombie entry in the project structure inside this group (its the new version **.xcdatamodel I have created) that I can't open (message like in the title). Probably because reverting deleting the files but somehow the reference is still there. Just a little bit

How to simply delete old core data and rebuilt the new one?

纵然是瞬间 提交于 2020-01-13 02:15:56
问题 I tried to migrate coreData to new version, I'm following this step: Add a new Model Version (Select name.xcdatamodeld then Editor->Add model Version) before making any changes, if you have an app already submitted to App Store which is using the earlier model version. Then, Add a new file from Core Data Tab, as Mapping Model Select, Source Model (Model Version which the submitted App is using) Destination Model (Model Version in which you have done the Changes) source But my data mostly are

Core Data migration fails for to-one relationship

旧街凉风 提交于 2020-01-10 05:37:25
问题 I have the following model: parent is a to-one relationship (optional, no minimum, maximum=1). children is the inverse to-many relationship (optional, no minimum, no maximum). I added a new model version, where only the Entity Room is renamed to Classroom , all other entities are unchanged: I also created a mapping model for the migration, but the migration fails with the error message reason = "Can't find mapping model for migration"; The strange thing is that if the parent relationship is

Core Data - lightweight migrations and multiple core data model files (xcdatamodel)

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-09 12:36:02
问题 I'm having a problem performing a lightweight migration when migrating from a store that is defined by two separate xcdatamodel files. In version 1.0 of my app, I had the models broken out into an analytics model, model-A, and everything else in model-B. When compiling, the models would be grouped together and everything proceeded smoothly. When working on the new version, 1.1, I upgraded model-B by adding a new model version to model-B and setting that new version as active. The issue arises

iOS - Managing two CoreData models with MagicalRecord

你说的曾经没有我的故事 提交于 2020-01-06 08:39:21
问题 I'm using MagicalRecord to work with a CoreData model, which is likely to be versioned in the future. Now I need to add to my app a pre-populated database with one entity of about 80000 objects; this data is static and I'm not expected it will ever change. If I added this entity to the existing model I would need to generate a new seed db every time the model changes, increasing the project complexity. A better solution would be creating a second model, just for the new entity: the seed db

iPhone Core Data Lightweight Migration: Can't merge models

泄露秘密 提交于 2019-12-29 07:12:11
问题 I just started with iPhone core data and I ran into a problem in lightweight migration. I added two new fields to my old model Regenerated the model class files Made the new model version as current version Added the following code in AppDelegate in the template generated NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; if

“Can't find model for source store” occurring during iphone “Automatic Lightweight Migration”?

≡放荡痞女 提交于 2019-12-28 12:01:31
问题 I'm really stuck here with upgrade testing from v1 to v2 of an iPhone application. I have IPA releases that I'm testing via ad hoc distribution via iTunes to my iPhone device, one for v1 of the app and one for v2. Note that: v1 installs runs fine on my device if I delete v1 and deploy v2 (so no migration) then it works fine when I deploy v2 whilst v1 is already there I get the error: "reason=Can't find model for source store" A snippet from the error...* reason=**Can't find model for source

app getting crashed while creating the managedObjectModel of Coredata

不想你离开。 提交于 2019-12-25 02:43:17
问题 I am creating a managedObjectModel object from the following code - (NSManagedObjectModel *)managedObjectModel { if (managedObjectModel_ != nil) { return managedObjectModel_; } NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"DataHouse" ofType:@"momd"]; NSURL *modelURL = [NSURL fileURLWithPath:modelPath]; managedObjectModel_ = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; return managedObjectModel_; } i have DataHouse.xcdatamodeld file in my xcode project. This

Core Data Migration Fail [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-23 04:55:08
问题 This question already has answers here : Fix Core Data Fail (3 answers) Closed 6 years ago . My app was recently crashing on the app store because I did not migrate the data. So I was following this tutorial on Core Data Migration but it does not seem to be working: 1.I created a new model version for Core Data and set it to the current version... 2.I added the following code: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (_persistentStoreCoordinator != nil) { return

Must I enable versioning in my first release in order to use lightweight migration in subsequent releases?

你。 提交于 2019-12-22 16:50:00
问题 My fear is the change of the data model in subsequent releases. I created a new xcdatamodel file in Xcode which is not versioned by default. I know you can click somewhere and make it "the first version". In the Groups and Files tree the xcdatamodel file gets a thick black arrow on the left side which you can click to see all the versions inside. My file does not have that thick arrow so is not versioned. Does this cause big problems later? Is it needed to version it right from the start to