Ishikawa
Ishikawa

Reputation: 668

Updating object in core data causes app to crash

I am fairly new at core data and am having a problem. My app currently is quite simple. I have a list of users with a username and an email. The app launched and pulls all the users from the local database via core data NSFetchedRequest. The app currently can create, read, and delete with no errors. I followed the apple tutorial on core data.

The problem I am having is saving an editted user. When clicking on the user, the edit view controller is shown where the person can edit the username and email of that particular user. When I go to update and save the user, the app crashes. The error is:

2012-04-09 17:47:09.757 SEA[7032:fb03] CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. [ valueForUndefinedKey:]: the entity User is not key value coding-compliant for the key "timeStamp". with userInfo { NSTargetObjectUserInfoKey = " (entity: User; id: 0x880ec10 ; data: {\n email = \"[email protected]\";\n username = sampleUser1;\n})"; NSUnknownUserInfoKey = timeStamp; } 2012-04-09 17:47:09.760 SEA[7032:fb03] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ valueForUndefinedKey:]: the entity User is not key value coding-compliant for the key "timeStamp".'

From the looks of the error, its still seeing the attribute timeStamp even though I deleted that attributed. The user entity is like to following:

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>


@interface User : NSManagedObject

@property (nonatomic, retain) NSString * username;

@property (nonatomic, retain) NSString * email;

@end

If someone could please help me I would truly appreciate it.

Upvotes: 0

Views: 1171

Answers (1)

Paul.s
Paul.s

Reputation: 38728

If you have just edited the Apple sample code is there any mention to updating a property called timeStamp.

Do a project wide search for timeStamp and update as appropriate (e.g. remove any mention as you are not using it in your model)

Upvotes: 0

Related Questions