• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quit helper app when main app terminates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit helper app when main app terminates


  • Subject: Re: Quit helper app when main app terminates
  • From: Mark Munz <email@hidden>
  • Date: Thu, 12 Jul 2012 13:03:15 -0700

> 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 <email@hidden> 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                 email@hidden
> 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 (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


References: 
 >Quit helper app when main app terminates (From: Jerry Krinock <email@hidden>)
 >Re: Quit helper app when main app terminates (From: Robert Martin <email@hidden>)
 >Re: Quit helper app when main app terminates (From: Mark Munz <email@hidden>)
 >Re: Quit helper app when main app terminates (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: Quit helper app when main app terminates
  • Next by Date: Re: Quit helper app when main app terminates
  • Previous by thread: Re: Quit helper app when main app terminates
  • Next by thread: Re: Quit helper app when main app terminates
  • Index(es):
    • Date
    • Thread