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



Daniel,

When your app launches you need to walk the process list and discover if another instance of your app is running. If you find one, bring it to the front and then quit. You could use the unique creator code you registered (you have registered haven't you?) or your unique bundle identifier, such as com.hotmail.danielbirns.yourappname.

This will result in only one instance of your app running, which circumvents the designed operation, but may be necessary in your instance [sorry].

Of all the Mac OS X sins you could commit, I think most people would let you get away with this one.

Douglas

On Jan 12, 2007, at 2:06 PM, John Stiles wrote:

If you duplicate the app, that duped copy is a separate file which can make a separate instance of the app. That's by design.

File associations are not bound to a path. The app can be found by the OS no matter where it lives. (I believe Launch Services maintains an alias to the app, but that is just a guess... anyway, it doesn't matter, that part "just works.")


On Jan 12, 2007, at 2:00 PM, Daniel Birns wrote:

John,

You're right. Using XCode this happened all the time.
Also, it appears to happen if you have copied the app to 2 different locations, and click on both the different locations.


Which brings up a related issue: currently we're planning to distribute with a .DMG file that contains the app and perhaps a readme file with the expectation that the user will know to copy this to a convenient place: perhaps the desktop, perhaps the Applications folder. Is this a reasonable assumption? And if so, what happens if they move it later? In particular, the file associations seem to be to a particular path to the app, and if that path changes, what happens to the file associations?

--Daniel

On Jan 12, 2007, at 1:26 PM, Daniel Birns wrote:


All,

I need to ensure that there's only one instance of my app running.
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.

--Daniel

_______________________________________________ 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
References: 
 >RE: One instance of app running (From: Daniel Birns <email@hidden>)
 >Re: One instance of app running (From: John Stiles <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.