0

Possible Duplicate:
How to create a Menubar application for Mac

I have implemented a feed with Cocoa, for Mac OS X.
It's a status application, displaying only the menu.Now basically I got three questions:

  • When I launch it I always see the application icon in the dock.But this is a menu status application, how do I remove the dock icon? It should be an application like Watts and Dropbox, a pure menu;
  • How do I prevent the user from launching the application multiple times? If the user does so, I would like to not launch a second instance of the application.
Community
  • 1
  • 1
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187

1 Answers1

1

How do I prevent the user from launching the application multiple times? If the user does so, I would like to not launch a second instance of the application.

That would commonly be done using a filesystem lock (flock) on unix based systems.

But then again, Cocoa has an even simpler solution for that; you may check if an application is active by supplying its bundle identifier to the system.

NSRunningApplication runningApplicationsWithBundleIdentifier:

See the NSRunningApplication Reference for more.

Till
  • 27,559
  • 13
  • 88
  • 122
  • 2
    Actually, for number two, I recommend an NSMachPort check: https://gist.github.com/3956491 – CodaFi Dec 26 '12 at 21:06