问题描述
启用核心数据迁移调试后,在执行迁移时,我看到三个实体(2、3、4)的哈希值已更改,正如预期的那样.实体 1 没有变化,仅供说明.
With Core Data Migration Debug enabled, when performing a migration I see three entities (2, 3, 4) with changed hashes, as expected. Entity 1 doesn't change and is for illustration.
存储元数据(源模型):
Store metadata (source model):
Entity1 = <67852e01 ...>;
Entity2 = <2b68bba5 ...>;
Entity3 = <58babd8d ...>;
Entity4 = <1c694c80 ...>;
当前模型(目标模型):
Current model (destination model):
Entity1 = <67852e01 ...>;
Entity2 = <260e4d68 ...>;
Entity3 = <13360b6f ...>;
Entity4 = <16513e1b ...>;
接下来,我创建了映射模型,但映射模型中的哈希值与实际模型中的哈希值不同:
Next, I create the mapping model, but the hashes in the mapping model are different than those in the actual models:
映射模型源哈希:
Entity1 = <67852e01 ...>;
Entity2 = <2b68bba5 ...>;
Entity3 = <d66bed18 ...>; // !!!
Entity4 = <2c56997a ...>; // !!!
映射模型目标哈希:
Entity1 = <67852e01 ...>;
Entity2 = <260e4d68 ...>;
Entity3 = <cb08343c ...>; // !!!
Entity4 = <1bc2cf8c ...>; // !!!
可以使用与实际商店的哈希值不同的哈希值创建映射模型的原因是什么?我看了这个问题并尝试更新映射模型的模型,但它不起作用.
What are the reasons the mapping model could be created with different hashes than the actual store's hashes? I looked at this question and tried updating the Mapping Model's models, but it didn't work.
推荐答案
最终奏效的解决方案是创建一个新模型版本,其中删除了这些实体,然后创建另一个新模型,重新引入实体.
The solution that finally worked was to create a new model version in which those entities were removed, then create another new model, with the entities re-introduced.
这篇关于核心数据映射模型版本哈希与源模型版本哈希不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!