我想将当前日期存储到核心数据中。该实体称为 Emotions,具有多个属性 (float) 和一个名为 timeStamp(Date) 的属性。浮动属性没有任何问题。但是当我尝试像这样存储日期时:
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 = "开店的型号和开店的型号不兼容"; }
谁能帮我?非常感谢你!