I want to store the current date into the core data. The entity is called Emotions with several attributes(float) and a attribute named timeStamp(Date). Nothing is wrong with the float attributes. But when I tried to store date like this:
emotionAppDelegate * appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *emotion =
[appDelegate managedObjectContext];
NSManagedObject *newEmotions;
newEmotions = [NSEntityDescription
insertNewObjectForEntityForName:@"Emotions"
inManagedObjectContext:emotion];
[newEmotions setValue:[NSData data] forKey:@"timeStamp"];
I got an error:
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=The model used to open the store is incompatible with the one used to create the store}, {
metadata = {
NSPersistenceFrameworkVersion = 419;
NSStoreModelVersionHashes = {
Emotions = ;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
“”
);
NSStoreType = SQLite;
NSStoreUUID = “5CE10BB2-A77A-4E8B-AAE6-5973000DFADA”;
“_NSAutoVacuumLevel” = 2;
};
reason = “The model used to open the store is incompatible with the one used to create the store”;
}
Can anyone help me? Thank you very much!
somehow you changed the database model, try to reset your simulator and run the application agian