> Although rare, it is possible to have more than one app with the same bundle 
> id running at the same time.

Sorry - I wrote that code in email and mixed up the ProcessIdentifier
return type with the BundleIdentifier return type in my head.

Correct code for bundle ID should look like this:

    NSArray* helperAppList = [NSRunningApplication
runningApplicationsWithBundleIdentifier:@"bundle.id"];
    for (NSRunningApplication* app in helperAppList)
    {
        [app terminate];
    }

This will terminate all the helpers that share the same bundle ID.

You can also use process id variation to get a specific helper.
+ (NSRunningApplication *)runningApplicationWithProcessIdentifier:(pid_t)pid

The real sticking issue -- is the sandbox. If you stuck in the
sandbox, you can't terminate helper apps.

On Thu, Jul 12, 2012 at 12:50 PM, Sean McBride <s...@rogue-research.com> wrote:
> On Thu, 12 Jul 2012 10:54:13 -0700, Mark Munz said:
>
>>If you're on 10.6 or later:
>>
>>- (void)applicationWillTerminate:(NSNotification *)aNotification
>>{
>>       NSRunningApplication* helperApp = [NSRunningApplication
>>runningApplicationsWithBundleIdentifier:@"bundle.id"];
>>       [helperApp terminate];
>>}
>
> Although rare, it is possible to have more than one app with the same bundle 
> id running at the same time.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 s...@rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>



-- 
Mark Munz
unmarked software
http://www.unmarked.com/

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to