Re: CoreData: Using willSave to update timestamps causes hang?
Re: CoreData: Using willSave to update timestamps causes hang?
- Subject: Re: CoreData: Using willSave to update timestamps causes hang?
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 2 May 2005 09:21:23 -0700
On May 2, 2005, at 8:37 AM, Jim Correia wrote:
- (void)willSave
Invoked automatically by the Core Data framework when the
receiver’s
managed object context is saved. It is commonly used to compute
persisted values from other transient values, to set
timestamps, and so
on. This method can have “side effects” on the persistent values.
When I use this to do that exactly - modify the last saved
timestamp of an object, I get a hang when saving. It appears that
making the change inside of willSave causes willSave to be called
again.
- (void)willSave
{
[self setValue: [NSDate date] forKey: @"lastSavedDate"];
}
- (void)willSave
{
[self setPrimitiveValue: [NSDate date] forKey: @"lastSavedDate"];
}
(Otherwise you're sending additional change notifications during the
save process.)
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden