• 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: Relaunching an application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Relaunching an application


  • Subject: Re: Relaunching an application
  • From: Mattias Arrelid <email@hidden>
  • Date: Mon, 3 Mar 2008 18:18:34 +0100

On 3 mar 2008, at 18.14, Nir Soffer wrote:

On Mar 3, 2008, at 18:24, Mattias Arrelid wrote:

I have an application that I need to restart.

Why do you want to do that?

A scenario could be that the entire contents of the .app bundle has been replaced with new stuff (e.g. the case with Sparkle).


An easy way to do this could be:

[[NSWorkspace sharedWorkspace] launchApplication:executablePath];
[NSApp terminate:self];

The problem is that the above solution results in confusion in the system dock; sometimes the original application does manage to quit before the new instance, other times not. If it does NOT manage to quit before the new one is launched, the dock ends up with two icons for my application; one that indicates that the application is launched, another one that's indicates that it's not launched. This is NOT good.

I've seen other programs in need of a restart (e.g. the Sparkle framework) using a separate helper application that simply checks whether the original process has quit properly before re-launching it. This sure does work, but it isn't a pretty solution.

Seems pretty to me. You want use a separate process to make this work reliably.

It works, but I'd say it was prettier if there was a framework call to accomplish this.


Regards
Mattias
_______________________________________________

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


  • Follow-Ups:
    • Re: Relaunching an application
      • From: John Stiles <email@hidden>
    • Re: Relaunching an application
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Relaunching an application (From: Mattias Arrelid <email@hidden>)
 >Re: Relaunching an application (From: Nir Soffer <email@hidden>)

  • Prev by Date: Re: displaying image and multiple rows of text in NSTableView row
  • Next by Date: keydown, determining if a keypress was "repeated"
  • Previous by thread: Re: Relaunching an application
  • Next by thread: Re: Relaunching an application
  • Index(es):
    • Date
    • Thread