Re: implementing relaunch in a sandboxed app
Re: implementing relaunch in a sandboxed app
- Subject: Re: implementing relaunch in a sandboxed app
- From: Kyle Sluder <email@hidden>
- Date: Tue, 18 Dec 2012 09:47:42 -0800
On Dec 18, 2012, at 9:27 AM, Keith Knauber <email@hidden> wrote:
> Automatic relaunch of your app is such a basic software requirement,
It is?
> and apple has never published a clean method for accomplishing this.
Ape's crash reporter offers to relaunch the app.
> There are situations when a relaunch of an app is much safer, faster, and fault tolerant than an approach which kills every background thread,
> deletes all your NSDocument objects, and open a new NSDocument.
The desired user experience is that after a relaunch NSDocumentController reopens all the documents that were open at the time of the crash.
>
> - (void) applicationWillTerminate:(NSNotification *)notification
> {
> … do clean-up tasks like NSUserDefaults synchronize, etc. …
>
> if ( ! userWantsRelaunch )
> return;
This won't be executed if you crash, and you certainly shouldn't trap all exceptions and go through the normal quit process to make it do so.
Are you trying to auto relaunch for reasons other than a crash? If so, why?
If it's for software update reasons, then self-exec is not a good idea because the old version app will likely remain mapped and will be relaunched. Better to have a helper script that waits for the process to quit and the file to be replaced before actually doing the launching.
I can't really think of any reason other than crash or self-update where relaunching the app is the correct user experience.
--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