Re: Knowing when application terminates...
Re: Knowing when application terminates...
- Subject: Re: Knowing when application terminates...
- From: Philip George <email@hidden>
- Date: Thu, 18 Jul 2002 14:00:33 -0500
Scratch what I said about TextEdit.app... I think my eyes were playing
tricks on me. It properly triggers that notification. I'm fairly sure
that I've seen other apps fail to do so though. Anyway, it will
probably work perfectly with your app.
- Philip
one line of code that should go in your app's startup code plus your
handler method:
...
// somewhere in your startup code
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
selector:@selector(somethingjustquit:)
name:@"NSWorkspaceDidTerminateApplicationNotification"
object:nil];
...
// handler method
- (void)somethingjustquit:(NSNotification *)notif {
NSLog(@"%@",[notif description]);
}
Reading the output of that NSLog() will give you some idea of how to
figure out if the application you're interested in is the app that just
quit. For whatever reason, by the way, not ALL apps trigger this
notification when they quit, for instance TextEdit.app, but BBEdit
does. Not sure why. Let's hope the app you're interested in does.
:)
- Philip
On Thursday, July 18, 2002, at 12:17 PM, Albert Atkinson wrote:
>
NSWorkspaceDidTerminateApplicationNotification
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.