Mailing Lists: Apple Mailing Lists

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

Re: One instance of app running



Am 13.01.2007 um 21:00 schrieb Daniel Birns <email@hidden>:

All,

I need to ensure that there's only one instance of my app running.

Worldwide? In a LAN? On the machine? In one user context?

It makes a difference because you can have multiple users log in to the machine at the same time and each one of them can normally launch the same apps.

So what is the reason you only want a single instance of your app?

Depending on your answers you could try to use some sort of lock which the first running instance of your app sets on launch and deletes on quit. But this is tricky because you need to clear the lock even if the app crashes or if it gets terminated by a kill -9 signal.

Or you could search for other running copies of your app using the bundle id or creator code. This will likely only work within one users session. For a mchine wide search you probably need to use some sort of notification system or a network based solution. Bonjour might help to find the other instances for example.


Some of this seems to happen automatically -- for example, if I click on my doc-type, it starts up the app if it's not running, or sends an open doc event to it if it is running. But if I click on the app it starts another instance, and this is what I don't want to have happen. Instead, I'd like it to turn into a reopen apple event to the existing instance.

Others have already commented on these points.


HTH Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Note: I read this list in digest mode! Send me a private copy for faster responses.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-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.