1
所以我決定創建一個實體的2個子實體。核心數據映射模型不能正確使用哈希
測試我創建這兩個實體沒有任何屬性既不關係。
如果我使用推理映射模型,核心數據將失敗,並且應用程序出現崩潰。報告here
如果我創建一個映射模型,核心數據也不能升級。我檢查了核心數據日誌,它說實體哈希值是正確的。 這裏有什麼可能是錯的?
CoreData: annotation: Incompatible version schema for persistent store
'file://localhost/Users/.../StoreContent/persistentStore'.
store metadata = {
NSPersistenceFrameworkVersion = 419;
NSStoreModelVersionHashes = {
Chat = <05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>;
Contact = <7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>;
Message = <45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>;
User = <1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
3July13
);
NSStoreType = SQLite;
NSStoreUUID = "73F77A17-9720-4D0E-90DD-D07A0EAECB29";
"_NSAutoVacuumLevel" = 2; } and current model versions = {
Broadcast = <e2afd25a 758f8e8b 7a2e1f2d 03042e32 e5e23693 a4935257 04a8e9fb 535e2452>;
Chat = <05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>;
Contact = <7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>;
Group = <67fa7527 b68ea99d ee8e704f 30f20e48 58350963 73e29c19 8aea7604 dfac7d7c>;
Message = <45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>;
User = <1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>; }
2013-07-04 10:25:53.678 JonglaIM[90118:22103]
CoreData: annotation: (migration) will attempt automatic schema
migration 2013-07-04 10:25:55.209 x[90118:22103] CoreData:
annotation: (migration) looking for mapping model with source
hashes: {
Chat = <05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>;
Contact = <7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>;
Message = <45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>;
User = <1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>; }
destination hashes: {
Broadcast = <e2afd25a 758f8e8b 7a2e1f2d 03042e32 e5e23693 a4935257 04a8e9fb 535e2452>;
Chat = <05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>;
Contact = <7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>;
Group = <67fa7527 b68ea99d ee8e704f 30f20e48 58350963 73e29c19 8aea7604 dfac7d7c>;
Message = <45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>;
User = <1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>; }
2013-07-04 10:25:55.214 x[90118:22103]
CoreData: annotation: (migration) checking mapping model at path
file://localhost/Users/.../Model.cdm
source hashes: {(
<1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>,
<7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>,
<05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>,
<45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>)}
destination hashes: {(
<e2afd25a 758f8e8b 7a2e1f2d 03042e32 e5e23693 a4935257 04a8e9fb 535e2452>,
<1400bc94 f742db62 91627ea5 883e54a8 104da454 a9a7b073 f1e827ad 26f7e7c8>,
<7f14d6ac 1bf1035e 63208d38 c048c396 d6385a95 3c8aec0b 36fbb86f 293fdb4d>,
<67fa7527 b68ea99d ee8e704f 30f20e48 58350963 73e29c19 8aea7604 dfac7d7c>,
<05d870d5 8d51e966 51a6b121 56fd0eff 6a35760e 829245ce 38e82724 b511b400>,
<45852277 e01bffe5 a83f71fe 09c20dba 838bb51c 411dc185 56ba4ff1 7b68ba3d>)} 2013-07-04 10:25:55.215 x[90118:22103] CoreData:
annotation: (migration) no suitable mapping model found
在「尋找映射模型...目的地散列」下,廣播線路是空的 - 這只是一個錯誤的複製/粘貼?假設是這樣的,你是否已經試圖明確地將映射模型設置爲Model.cdm,而不是讓CoreData進行比較來找到匹配?我懷疑這不會解決問題,但可能會生成一個不同的錯誤消息,並提供有關爲什麼模型未被接受的更多信息(但不確定,但不必明確映射自己)。 –
如何將映射設置爲我的model.cdm文件? 我剛剛看到核心數據搜索我的映射文件,它發現它並嘗試使用,但沒有成功。 –
我一直在尋找我的代碼和書籤來弄清楚我是如何手工指定映射模型的,有一次我嘗試了它,但不幸的是還沒有拿出任何東西。但是,我確實遇到了這個問題,這與您的問題看起來完全相同,並提供了一些可能的解決方案:http://blog.vucica.net/2013/04/core-data-migrating-ignores-manual-mapping-model-或 - 失敗 - 遷移 - 儘管映射模型存在.html –