Mailing Lists: Apple Mailing Lists

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

NSApplicationWillTerminateNotification problem




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

This email sent to 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.