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

Re: Exit an Application


  • Subject: Re: Exit an Application
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 13 Apr 2009 23:52:15 +0200

On 13.04.2009, at 16:19, Filip van der Meeren wrote:
You could always call exit(); from C
or [NSApp terminate:XXX];


Well,

calling exit() is the best way to shoot yourself in the foot. That would exit the app immediately, without saving any unsaved documents, without writing any cached NSUserDefaults changes to the hard disk etc. Its effect in a regular Cocoa application is only slightly better than choosing "Force Quit" and shooting down the app. In short, don't do it.

 [[NSApplication sharedApplication] terminate: nil];

or the slightly shorter and a thoretically a tad more dangerous similar call with NSApp in it are really the only option. (Well, theoretically you could send yourself a "quit" Apple Event, but that's only of academical interest...)

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

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: Exit an Application
      • From: Benjamin Dobson <email@hidden>
    • Re: Exit an Application
      • From: WT <email@hidden>
References: 
 >Exit an Application (From: Luca Ciciriello <email@hidden>)
 >Re: Exit an Application (From: Filip van der Meeren <email@hidden>)

  • Prev by Date: NSSliderCell, lockFocus question
  • Next by Date: Re: Dynamically getting the type of ivars
  • Previous by thread: Re: Exit an Application
  • Next by thread: Re: Exit an Application
  • Index(es):
    • Date
    • Thread