Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData: Using willSave to update timestamps causes hang?




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >CoreData: Using willSave to update timestamps causes hang? (From: Jim Correia <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.