Re: Dis-Allowing Multiple Instances of an Application
Re: Dis-Allowing Multiple Instances of an Application
- Subject: Re: Dis-Allowing Multiple Instances of an Application
- From: "Kyle Sluder" <email@hidden>
- Date: Tue, 4 Mar 2008 03:43:11 -0500
On Tue, Mar 4, 2008 at 3:27 AM, ADIL SALEEM <email@hidden> wrote:
> I have made an application in Cocoa. From GUI it's multiple instances can not be launched. However, from command shell, multiple instances of the application can be launched.
This isn't how apps are supposed to be launched. open(1) is the
proper way to launch apps from the Terminal, and it uses Launch
Services to do so.
If you think this is going to be a common occurrence with your app
(and unless for some reason you instruct your users to do this, it
won't), then you could try using NSDistributedLock to try to lock some
known resource (say, your app's bundle) and, if it fails, abort the
app. But like I said, virtually no user will try to launch your app's
binary from the command line, and if they do they'll most likely use
open(1).
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden