问题描述
我创建了一个核心数据模型,当试图保存记录时,我得到以下控制台消息:未解决的错误Error Domain = NSCocoaErrorDomain Code = 134100无法完成操作(Cocoa错误134100.)UserInfo = 0x8b3bc50 {metadata = {
NSPersistenceFrameworkVersion = 479;
NSStoreModelVersionHashes = {
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers =(
);
NSStoreType = SQLite;
NSStoreUUID =F49C0E04-9778-46EC-A9C7-9A045CD915D8;
_NSAutoVacuumLevel= 2;
},reason =用于打开商店的模型与用于创建商店的模型不兼容},{
metadata = {
NSPersistenceFrameworkVersion = 479;
NSStoreModelVersionHashes = {
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers =(
);
NSStoreType = SQLite;
NSStoreUUID =F49C0E04-9778-46EC-A9C7-9A045CD915D8;
_NSAutoVacuumLevel= 2;
};
reason =用于打开商店的模型与用于创建商店的模型不兼容;
}
I have created a core data model and when trying to save records I get the following console message: Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x8b3bc50 {metadata={ NSPersistenceFrameworkVersion = 479; NSStoreModelVersionHashes = { }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers = ( "" ); NSStoreType = SQLite; NSStoreUUID = "F49C0E04-9778-46EC-A9C7-9A045CD915D8"; "_NSAutoVacuumLevel" = 2;}, reason=The model used to open the store is incompatible with the one used to create the store}, { metadata = { NSPersistenceFrameworkVersion = 479; NSStoreModelVersionHashes = { }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers = ( "" ); NSStoreType = SQLite; NSStoreUUID = "F49C0E04-9778-46EC-A9C7-9A045CD915D8"; "_NSAutoVacuumLevel" = 2; }; reason = "The model used to open the store is incompatible with the one used to create the store";}
我不知道从哪里开始调试,请别人告诉我问题可能在哪里
I am not sure where to start to debug it please can someone tell me where the problem could be as I am new to core data.
推荐答案
从模拟器或设备中删除应用程序,清理项目并再次运行。
Remove your app from the simulator or device, clean the project and run it again.
更新:
这只适用于开发阶段,请务必了解模型版本,如下面的Patrick Goley所述。
Update:Do this only for development stages and be sure to understand the model versioning like Patrick Goley stated below.
这篇关于核心数据保存模型不工作iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!