Questions tagged [mapping-model]

A mapping model is a Core Data construct that helps define how one version of a object model is migrated to another version the object model.

A mapping model is a collection of objects that specifies the transformations that are required to migrate part of a store from one version of your model to another (for example, that one entity is renamed, an attribute is added to another, and a third split into two). You typically create a mapping model in Xcode. Much as the managed object model editor allows you to graphically create the model, the mapping model editor allows you to customize the mappings between the source and destination entities and properties.

from Core Data Model Versioning and Data Migration Programming Guide

68 questions
25
votes
2 answers

Add Core Data Index to certain Attributes via migration

For performance reasons, i want to set the Indexed Attribute to some of my entities. I created a new core data model version to perform the changes. Core Data detects the changes and migrates my model to the new version, however, NO INDEXES ARE…
steipete
  • 7,430
  • 5
  • 44
  • 80
25
votes
2 answers

Core Data Migration Across Multiple Version Upgrades

I have an iPhone app that uses Core Data. I did an update and used Lightweight Migration to go from V1 to V2 of my MOM (Managed Object Model). This worked perfectly. What happens when I want to go to V3 (and beyond) of my MOM? If I decide to…
thevoid
  • 659
  • 7
  • 12
22
votes
8 answers

I keep on getting "save operation failure" after any change on my Xcode Data Model

I started using Core Data for iPhone development. I started out by creating a very simple entity (called Evaluation) with just one string property (called evaluationTopic). I had following code for inserting a fresh string: - (void)insertNewObject…
Philip Schoch
13
votes
1 answer

Multiple Pass Core Data Migration In Chunks With iOS

I'm trying to migrate an iPhone/iPad sqlite store of about 11Mb. It has around thirty different entities, all quite heavily interrelated. On a 3GS, it takes quite some time. Even a lightweight migration takes around four minutes. I guess this is…
Max MacLeod
  • 24,338
  • 10
  • 91
  • 123
13
votes
2 answers

Setting dynamic ng-model names in AngularJS

There are similar questions here and here, although my use-case is a little different. I have an object called uniqueLists which looks like this: $scope.uniqueLists - { name: [ 'string1', 'string2', 'string3' …
JVG
  • 17,199
  • 36
  • 121
  • 195
12
votes
1 answer

Core data migration failing with "Can't find model for source store" but managedObjectModel for source is present

I have a cocoa application using core-data, which is now at the 4th version of its managed object model. My managed object model contains abstract entities but so far I have managed to get migration working by creating appropriate mapping models…
Ira Cooke
  • 1,295
  • 12
  • 20
11
votes
5 answers

Core Data migration problem: "Persistent store migration failed, missing source managed object model."

The Background A Cocoa Non Document Core Data project with two Managed Object Models. Model 1 stays the same. Model 2 has changed, so I want to migrate the store. I've created a new version by Design > Data Model > Add Model Version in Xcode. The…
John Gallagher
  • 6,000
  • 6
  • 35
  • 73
10
votes
2 answers

Core Data Inferred Migration – Automatic "lightweight" vs Manual

I've updated the model of an existing iPhone app in some simple ways (remove attribute, add attribute, remove index), and can use automatic lightweight migration to migrate the persistent store. Due to the typical size of the data set, the…
ohhorob
  • 11,465
  • 7
  • 37
  • 50
9
votes
4 answers

Core Data Migration - Can't find mapping model for migration

I followed the guide found here: http://www.timisted.net/blog/archive/core-data-migration/ but keep getting "Can't find mapping model for migration" when I start up the app with the new model. I've tried it in xcode 3 and xcode 4, multiple times,…
8
votes
1 answer

Core Data Force Custom Mapping Model/Policy instead of Lightweight Migration

I've got about 4 different versions of my data model now, and every one except the last one has been just a minor change using automatic lightweight migration. For this latest model, I need to do a bit of additional work during the migration, so I…
Cory Imdieke
  • 12,771
  • 8
  • 34
  • 46
7
votes
1 answer

Core Data lightweight migration: Can't find or automatically infer mapping model for migration

So I created a new version of my data model, and made a previously optional field non-optional (giving it a default value). According to the documentation, this should mean my migration is eligible for lightweight, automatic migration. I also added…
elsurudo
  • 3,359
  • 2
  • 26
  • 46
6
votes
1 answer

Strange Core Data crash with _Unwind_SjLj_Resume after migrating

I am getting a strange crash from some of my beta testers that I am having trouble with. The symbolicated crash reports indicate that the crash is occurring in the simple allocation of a controller as a singleton, at the init call, but according to…
coneybeare
  • 33,248
  • 21
  • 128
  • 182
5
votes
4 answers

Core Data - Migration question?

I am trying to do a migration I have 2 versions of model 1.xcdatamodel 2.xcdatamodel I created a mapping model from version 1 to 2 1to2.xcmappingmodel The problem is that it can't find the migration model that I created so mappingModel always gets…
aryaxt
  • 69,636
  • 87
  • 281
  • 421
5
votes
1 answer

Core Data Migration: Attribute Mapping Value Expression

I currently have a cardType attribute on my entity, which in the old model could be "Math", "Image" or "Text". In the new model, I'll be using just "Math" and "Text" and also have a hasImage attribute, which I want to set to true if the old cardType…
Philippe Sabourin
  • 8,015
  • 3
  • 28
  • 44
5
votes
2 answers

Core Data custom migration policy with multiple targets

If I want to use a custom migration policy for a given entity, I believe I have to prefix the class name by the product module name, as shown on the following image: How can I manage to handle multiple targets? I tried using the following entry:…
adauguet
  • 898
  • 7
  • 17
1
2 3 4 5