Re: How to keep creation/modification date of a (Core Data) object?
Re: How to keep creation/modification date of a (Core Data) object?
- Subject: Re: How to keep creation/modification date of a (Core Data) object?
- From: Tony Becker <email@hidden>
- Date: Mon, 9 Jul 2007 13:40:38 -0400
I believe you need both set/getter methods to be KVC compliant, and
thus, for the dependent key trigger to work.
Watch for typo's and make sure the originalKey is also KVO compliant
(will/did change if Core Data)
+ (void) initialize {
[self setKeys:[NSArray arrayWithObject:@"originalKey"]
triggerChangeNotificationsForDependentKey:@"newKey"];
...
}
-(void)setNewKey:(id)val {
...
}
-(id)newKey {
...
}
On Jul 9, 2007, at 1:23 PM, Arthur C. wrote:
On 08/07/07, Arthur C. <email@hidden> wrote:
This must be a simple use of setKeys:
triggerChangeNofiticationsForDependentKey, but I can't find the
right method
for the key 'modificationDate'...
Creation date is easy, just an awakeFromInsert will do.
But the modification date (obviously) has to change whenever any
of the keys
in the object changes. Moreover, it has to keep its value when we
are just
asking for the modification date (getter method), and on program
shutdown/restart.
Does it have to update everytime a value is changed, or only when the
object is saved and there are changed values (since those changed may
be reverted)? If so, you can override -willSave and update the
modification date in there.
In fact I want it to update on-the-fly, indeed. So a willSave is
not enough...
I tried adding an extra instance variable
'modificationDateChanged' (bool), to be updated by
triggerChangeNotification. The getter method would then call
setModificationDate; but somehow the method does not get called
(i.e. the triggerChangeNotification does not work).
Any better ideas?
Thanks,
Arthur C.
-Phil
_________________________________________________________________
Hotmail en Messenger on the move http://www.msn.nl/services
_______________________________________________
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
Tony Becker
Cell: 727 460 1891
Never be afraid to try something new.
Remember that the ark was built by amatures and the Titanic was built
by professionals.
_______________________________________________
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