自定义核心数据映射:在现有关系之间插入新实体

时间:2014-05-10 10:05:00

标签: core-data core-data-migration

我的数据模型版本1 的示例如下所示: enter image description here

蛋糕被一些客人吃掉了。

在数据模型版本2 中,并非每位客人都会吃到相同数量的碎片。我想为每位客人分配一些件: enter image description here

numberOfPieces可以设置为默认值1件。)

如何实现?我已经实现了自定义映射模型,并为映射CakeToCake设置了自定义策略。但是,我不确定该怎么做。我的策略是否必须实现createRelationshipsForDestinationInstance:entityMapping:manager:error:我将手动创建PieceOfCake对象?

1 个答案:

答案 0 :(得分:0)

我认为我做了正确的事,最后在PieceOfCake中创建了createRelationshipsForDestinationInstance:entityMapping:manager:error:。效果很好。

相关问题