Re: KVO and Coredata/Undo Clarification
Re: KVO and Coredata/Undo Clarification
- Subject: Re: KVO and Coredata/Undo Clarification
- From: Andre <email@hidden>
- Date: Wed, 15 Mar 2006 18:57:56 -0800
Thank mmalc for the quick reply.
mmalcolm crawford wrote:
On Mar 15, 2006, at 6:27 PM, email@hidden wrote:
does NSPersistenDocument know to record changes only to a variable
if its core data (not a custom ivar) value changed?
It's not clear why you think that NSPersistentDocument would record
changes? Changes are recorded by the relevant managed object
context's undo manager.
What I meant was that NSPersistent document shows the document as
dirty, of course as you say, its the undo manager of the context that
records the change.
- (void)setValue:(NSData *)value
{
[self willChangeValueForKey: @"value"];
[[self valueForKey:@"data"] setValue: value forKey: @"value"];
[self didChangeValueForKey: @"value"];
}
It's not clear why you're doing this?
The change notification messages are advertising that a property
with key-path 'value' is changing. It's not. The property with
key-path 'data.value' is changing... The 'data' object should be
responsible for sending its own change notification messages.
Ok, so then it should look like this: (just looking for clarification)
- (void)setValue:(NSData *)value
{
[[self valueForKey:@"data"] setValue: value forKey: @"value"];
}
....sometimes I notice that after save, I get the document "dirty
dot" (even with no undos remaining or uncommitted changes in the moc)
and am trying to track down where this was happening. (Somewhere I
did something wrong)
Andre
email@hidden
_______________________________________________
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