Re: Best practice for terminating at launch time?
Re: Best practice for terminating at launch time?
- Subject: Re: Best practice for terminating at launch time?
- From: Rob Keniger <email@hidden>
- Date: Wed, 11 Feb 2009 10:08:02 +1000
On 11/02/2009, at 9:39 AM, Graham Cox wrote:
The next question is about actually terminating. I currently simply
call [NSApp terminate:] which works, but I'm a bit worried that
there could be a way that this won't actually Quit, since it's only
a request to Quit, not a command. For example if the user launched
the app by double-clicking a file that needs some conversion as it's
read in, the document gets marked as dirty, and that allows a way
for the user to cancel the Quit. Is there a way to legally Quit an
app, no questions asked?
You can do something like the following in -
applicationDidFinishLaunching:
if([alert runModal] == NSAlertFirstButtonReturn)
{
exit(0);
}
else
{
[NSApp applicationOpenUntitledFile:NSApp];
}
A straight exit() may not be elegant but it certainly works just fine.
--
Rob Keniger
_______________________________________________
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