[Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
[Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
- Subject: [Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
- From: Aurélien Hugelé <email@hidden>
- Date: Fri, 22 May 2009 09:00:00 +0200
Hi list!
In the documentation it is clearly stated that we should not trigger
change notifications in the *didSave* method of NSmanagedObject.
The willSave method is not very well described. In particular, can we
use setValue:forKey: (or trigger change notifications) inside it?
I usually do something like :
-(void)willSave
{
if([self isDeleted])
{
// cleanup some other object state
// or use [self setValue:Y forKey:X] here
}
}
And as a result I often get a "strange" exception :
Failed to process pending changes before save. The context is still
dirty after 100 attempts. Typically this recursive dirtying is caused
by a bad validation method, -willSave, or notification handler."
it seems that for *deleted* objects only, triggering change
notifications is now allowed.
Am I right ?
Aurélien,
Objective Decision Team
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden