programatically quit a program

2008-08-28 Thread Wayne Shao
Hi What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. What is the call that would be equivalent to user explicitly selecting the Quit from the menu. I only found this [[NSApplication sharedApplication] te

Re: programatically quit a program

2008-08-28 Thread Robert Claeson
On 28 Aug 2008, at 22:38, Wayne Shao wrote: What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. What is the call that would be equivalent to user explicitly selecting the Quit from the menu. I only

Re: programatically quit a program

2008-08-28 Thread Andrew Farmer
On 28 Aug 08, at 13:38, Wayne Shao wrote: What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. What is the call that would be equivalent to user explicitly selecting the Quit from the menu. I only foun

Re: programatically quit a program

2008-08-28 Thread Ken Thomases
On Aug 28, 2008, at 3:38 PM, Wayne Shao wrote: What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. What is the call that would be equivalent to user explicitly selecting the Quit from the menu. I onl

Re: programatically quit a program

2008-08-28 Thread Ricky Sharp
On Aug 28, 2008, at 3:49 PM, Ken Thomases wrote: On Aug 28, 2008, at 3:38 PM, Wayne Shao wrote: But the terminate function takes an id for sender. What shall I use? In this case, you're the sender so you can pass "self". Or, if you're within an action method (IBAction) you can forward t

Re: programatically quit a program

2008-08-29 Thread Stéphane Sudre
On Aug 28, 2008, at 10:45 PM, Robert Claeson wrote: On 28 Aug 2008, at 22:38, Wayne Shao wrote: What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. What is the call that would be equivalent to user e

Re: programatically quit a program

2008-08-29 Thread Ben Stiglitz
What is the correct way to quit a cocoa app? I could use C exit() but that would loose the chance to invoke the right callbacks for clean up. FWIW, if you don’t have any termination delegate methods of your own, and don’t have any user defaults that might not be synchronized, it’s safe t