• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getting the app name of an app that quits
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the app name of an app that quits


  • Subject: Re: getting the app name of an app that quits
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 31 Aug 2003 01:54:02 -0400

On Aug 30, 2003, at 2:35 PM, email@hidden wrote:

i need to know when a certain program quits. so far, i register with
the notification center to find out when an app quits
...
CurrentAppsSharedWorkspace = [NSWorkspace sharedWorkspace];
WorkspaceNotificationCenter = [CurrentAppsSharedWorkspace
notificationCenter];

[WorkspaceNotificationCenter addObserver:self
selector:@selector(gameOver:)
name:@"NSWorkspaceDidTerminateApplicationNotification"
object:nil];
...
and gameOver: gets called fine and all but i need to know the
applications name to filter them out. any ideas how i can do this?
object is the only method in nsnotification i see that could help but
what would it return in my case?


Notifications get an object, and a UserInfo dictionary. And it's that dictionary that contains what you are seeking! You can get the name, path, process identifier and the high/low of the PSN.

From NSWorkspace...

NSWorkspaceDidTerminateApplicationNotification

Posted when an application finishes executing.

The notification object is the shared NSWorkspace instance. The userInfo dictionary contains the keys and values described in Constants.

That constants link gets you to what you want (the third table in the constants contains the key definitions and return types)
_______________________________________________
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.
References: 
 >getting the app name of an app that quits (From: email@hidden)

  • Prev by Date: pop up button with different cell class
  • Next by Date: Re: Text dragged on to the application icon?
  • Previous by thread: getting the app name of an app that quits
  • Next by thread: getting the app name of an app that quits
  • Index(es):
    • Date
    • Thread