NSApplicationWillTerminateNotification problem
NSApplicationWillTerminateNotification problem
- Subject: NSApplicationWillTerminateNotification problem
- From: Steve Gehrman <email@hidden>
- Date: Tue, 31 Jul 2007 17:53:39 -0700
I'm setting up a NSApplicationWillTerminateNotification, and I was
hoping it would tell me which key was just changed, but it doesn't
work as expected.
I am calling changedValues hoping that this would tell me which key
was just modified, but this only sends me key/values that are
different from the saved state. If I force it to save, then it does
work as expected, but I don't want to do this. I just want to know
what key was changed.
- (void)changeNotification:(NSNotification*)notification;
{
NSManagedObject *obj;
NSEnumerator *enumerator;
NSSet *updated = [[notification userInfo]
objectForKey:NSUpdatedObjectsKey];
enumerator = [updated objectEnumerator];
while (obj = [enumerator nextObject])
NSLog([[obj changedValues] description]);
}
So, if I have a key named "bold" and it's initially 0, then I get the
output from NSLog
{bold = 1; }
But If I toggle bold back to 0, I get this:
{}
I'm assuming this works just by comparing the current saved state to
the cached state and since bold started off 0, and now I toggled it
back to 0, I get no changes.
I just want to know what key was changed, I don't care if it matches
what is saved. I don't know a solution to this other than adding KVO
to all my keys and monitoring changes this way.
Anyone know how to get this working they way it should?
-steve
_______________________________________________
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