我刚开始学习使用Core Data。在我第一次尝试将对象添加到数据库时,我收到了以下内容:
2011-08-03 15:21:32.519 StuffNearMe[45040:15503] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x81f03d0 {metadata=<CFBasicHash 0x81efed0 [0x1608ba8]>{type = immutable dict, count = 7,
entries =>
2 : <CFString 0x81ef8f0 [0x1608ba8]>{contents = "NSStoreModelVersionIdentifiers"} = <CFArray 0x81efa00 [0x1608ba8]>{type = immutable, count = 1, values = (
0 : <CFData 0x81ef9d0 [0x1608ba8]>{length = 0, capacity = 0, bytes = 0x}
)}
4 : <CFString 0x81ef920 [0x1608ba8]>{contents = "NSPersistenceFrameworkVersion"} = <CFNumber 0x81efa20 [0x1608ba8]>{value = +363, type = kCFNumberSInt64Type}
6 : <CFString 0x81ef950 [0x1608ba8]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x81eff50 [0x1608ba8]>{type = immutable dict, count = 2,
entries =>
1 : <CFString 0x81efa30 [0x1608ba8]>{contents = "FavoriteAddress"} = <CFData 0x81efa70 [0x1608ba8]>{length = 32, capacity = 32, bytes = 0x0716904fb7c1b83554338231858021ed ... a0b76e5dbab42a40}
2 : <CFString 0x81efa50 [0x1608ba8]>{contents = "RecentAddress"} = <CFData 0x81eff00 [0x1608ba8]>{length = 32, capacity = 32, bytes = 0x9406126d6ea281dc3e96eed795fc67d8 ... 176c5845b46ca895}
}
7 : <CFString 0x11a7b18 [0x1608ba8]>{contents = "NSStoreUUID"} = <CFString 0x81efc80 [0x1608ba8]>{contents = "D4569F82-247B-4D4E-99DA-990570C0E6B5"}
8 : <CFString 0x11a7988 [0x1608ba8]>{contents = "NSStoreType"} = <CFString 0x11a7998 [0x1608ba8]>{contents = "SQLite"}
9 : <CFString 0x81ef980 [0x1608ba8]>{contents = "_NSAutoVacuumLevel"} = <CFString 0x81effa0 [0x1608ba8]>{contents = "2"}
10 : <CFString 0x81ef9a0 [0x1608ba8]>{contents = "NSStoreModelVersionHashesVersion"} = <CFNumber 0x813f720 [0x1608ba8]>{value = +3, type = kCFNumberSInt32Type}
}
, reason=The model used to open the store is incompatible with the one used to create the store}, {
metadata = {
NSPersistenceFrameworkVersion = 363;
NSStoreModelVersionHashes = {
FavoriteAddress = <0716904f b7c1b835 54338231 858021ed a81f0bb5 c0dc6347 a0b76e5d bab42a40>;
RecentAddress = <9406126d 6ea281dc 3e96eed7 95fc67d8 728976d1 92a0b26a 176c5845 b46ca895>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
<>
);
NSStoreType = SQLite;
NSStoreUUID = "D4569F82-247B-4D4E-99DA-990570C0E6B5";
"_NSAutoVacuumLevel" = 2;
};
reason = "The model used to open the store is incompatible with the one used to create the store";
}
非常感谢任何帮助或建议!首次开始使用时,核心数据非常混乱。
答案 0 :(得分:2)
错误是:
用于打开商店的模型与用于创建商店的模型不兼容
这可能是因为您在首次创建模型后更改了模型。如果您需要在创建架构后更改架构,请查看Core Data Model Versioning and Data Migration Programming Guide。