核心数据的新手,persistentStoreCoordinator中出现错误 [英] New to Core Data, getting error in persistentStoreCoordinator
问题描述
我刚刚开始学习使用核心数据。在我第一次尝试向数据库添加对象时,收到以下消息:
I've just started learning to use Core Data. On my first attempt to add an object to the database, I received the following:
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";
}
任何帮助或建议都将不胜感激!
Any help or advice would be greatly appreciated! Core Data is so confusing when you first begin using it.
推荐答案
错误是:
用于开设商店的模型与用于创建商店的模型不兼容
The model used to open the store is incompatible with the one used to create the store
这可能是因为您自首次创建模型以来就对其进行了更改。如果需要在创建架构后对其进行更改,请查看核心数据模型版本控制和数据迁移编程指南。
This is likely because you changed the model since you first created it. If you need to change the schema after creating it, take a look at the Core Data Model Versioning and Data Migration Programming Guide.
这篇关于核心数据的新手,persistentStoreCoordinator中出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!