Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
561 views
in Technique[技术] by (71.8m points)

ios - Core Data Mapping Model version hashes not matching to source model version hashes

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:

Mapping Model Source Hashes:

Entity1 = <67852e01 ...>; 
Entity2 = <2b68bba5 ...>; 
Entity3 = <d66bed18 ...>; // !!!
Entity4 = <2c56997a ...>; // !!!

Mapping Model Destination Hashes:

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...