已编辑xcdatamodeld的实体,但在swift中获取崩溃核心数据
我重命名了已编辑xcdatamodeld的实体,但在swift中获取崩溃核心数据,swift,sqlite,core-data,Swift,Sqlite,Core Data,我重命名了name.xcdatamodeld的一些实体,并删除了其他实体,然后我从模拟器中删除了应用程序并重新启动了它,但当我运行应用程序时,出现以下崩溃: PortalApp[4672:94749] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/me/Library/Developer/CoreSimulator/Devices/C094CF3E-7181-40A
name.xcdatamodeld的一些实体
,并删除了其他实体
,然后我从模拟器中删除了应用程序并重新启动了它,但当我运行应用程序时,出现以下崩溃:
PortalApp[4672:94749] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/me/Library/Developer/CoreSimulator/Devices/C094CF3E-7181-40AC-A524-3F8A8DFF4435/data/Containers/Data/Application/4B52E366-DB37-4E7C-AB65-DA7B4D2B3BB3/Documents/MyDB.sqlite options:(null) ... returned error Error Domain=NSCocoaErrorDomain Code=134100 "(null)" UserInfo={metadata={
NSPersistenceFrameworkVersion = 866;
NSStoreModelVersionHashes = {
Degrees = <2b0631df 5061efec 22ec7f0a dcf7e24f b77c2c73 2f8b9e31 97232c2d 17e05d98>;
ShortMajorTBL = <9d0263c5 f17cc305 bff7b776 df4a4318 62036151 4d526781 2a21fdde c33a28f1>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "2AC92D09-DE75-40EA-827A-3217C64A301E";
"_NSAutoVacuumLevel" = 2;
}, reason=The model used to open the store is incompatible with the one used to create the store} with userInfo dictionary {
metadata = {
NSPersistenceFrameworkVersion = 866;
NSStoreModelVersionHashes = {
Degrees = <2b0631df 5061efec 22ec7f0a dcf7e24f b77c2c73 2f8b9e31 97232c2d 17e05d98>;
ShortMajorTBL = <9d0263c5 f17cc305 bff7b776 df4a4318 62036151 4d526781 2a21fdde c33a28f1>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "2AC92D09-DE75-40EA-827A-3217C64A301E";
"_NSAutoVacuumLevel" = 2;
};
reason = "The model used to open the store is incompatible with the one used to create the store";
}
PortalApp[4672:94749][error]错误:-addPersistentStoreWithType:SQLite配置:(null)URL:file:///Users/me/Library/Developer/CoreSimulator/Devices/C094CF3E-7181-40AC-A524-3F8A8DFF4435/data/Containers/Data/Application/4B52E366-DB37-4E7C-AB65-DA7B4D2B3BB3/Documents/MyDB.sqlite 选项:(空)。。。返回的错误域=NSCOCAERRORDOMAIN Code=134100“(null)”UserInfo={metadata={
NSPersistenceFrameworkVersion=866;
NSStoreModelVersionHashes={
度=;
ShortMajorTBL=;
};
NSStoreModelVersionHashesVersion=3;
NSStoreModelVersionIdentifiers=(
""
);
NSStoreType=SQLite;
NSStoreUUID=“2AC92D09-DE75-40EA-827A-3217C64A301E”;
“_NSAutoVacuumLevel”=2;
},reason=用于打开存储的模型与用于创建存储的模型}与userInfo dictionary不兼容{
元数据={
NSPersistenceFrameworkVersion=866;
NSStoreModelVersionHashes={
度=;
ShortMajorTBL=;
};
NSStoreModelVersionHashesVersion=3;
NSStoreModelVersionIdentifiers=(
""
);
NSStoreType=SQLite;
NSStoreUUID=“2AC92D09-DE75-40EA-827A-3217C64A301E”;
“_NSAutoVacuumLevel”=2;
};
原因=“用于打开存储的模型与用于创建存储的模型不兼容”;
}
我删除了Degrees表
,并将ShortMajorTBL
重命名为FiltersTBL
我清除了项目并构建了它,但让我摆脱了崩溃。这是一个典型的案例,当商店创建时,实体的状态与实体的当前状态不同,这就是它抱怨的
有多种方法可以解决此问题
- 如果开发应用程序,从模拟器/设备中删除该应用程序可能会有所帮助
- 由于您正处于开发阶段,最简单的方法是找到
持久存储。一旦你有了这条路,就在
查找并删除3个sqlite文件(扩展名为.sqlite,
.slite shm、.sqlite wal),由核心数据作为
商店。您甚至可以通过编程方式销毁存储,但请确保在错误消失后删除存储销毁代码
- 如果您的应用程序已经在appstore上,并且您正在开发新的应用程序
版本,那么您应该考虑迁移,因为以上几点可能会为您提供临时解决方案