我想将当前日期存储到核心数据中。该实体称为Emotions,具有多个属性(float)和名为timeStamp(Date)的属性。 float属性没有任何问题。但是当我试图存储这样的日期时:
emotionAppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *emotion =
[appDelegate managedObjectContext];
NSManagedObject *newEmotions;
newEmotions = [NSEntityDescription
insertNewObjectForEntityForName:@"Emotions"
inManagedObjectContext:emotion];
[newEmotions setValue:[NSData data] forKey:@"timeStamp"];
我收到了一个错误:
2012-11-25 21:03:09.130 silder[4634:c07] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 "The operation couldn’t be completed. (Cocoa error 134100.)" UserInfo=0x8174b20 {metadata={
NSPersistenceFrameworkVersion = 419;
NSStoreModelVersionHashes = {
Emotions = <c8b9e393 5624a477 dee1958e 19dd1209 acb67cd9 56daefea dbf8bfc9 daa8e34d>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "5CE10BB2-A77A-4E8B-AAE6-5973000DFADA";
"_NSAutoVacuumLevel" = 2;
},reason =用于打开商店的模型与用于创建商店的模型不兼容},{ metadata = { NSPersistenceFrameworkVersion = 419; NSStoreModelVersionHashes = { 情绪=; }; NSStoreModelVersionHashesVersion = 3; NSStoreModelVersionIdentifiers =( “” ); NSStoreType = SQLite; NSStoreUUID =“5CE10BB2-A77A-4E8B-AAE6-5973000DFADA”; “_NSAutoVacuumLevel”= 2; }; reason =“用于打开商店的模型与用于创建商店的模型不兼容”; }
任何人都可以帮助我吗?非常感谢你!
答案 0 :(得分:1)
以某种方式更改数据库模型,尝试重置模拟器并再次运行应用程序