• 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: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate


  • Subject: Re: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate
  • From: Greg Herlihy <email@hidden>
  • Date: Fri, 26 May 2006 00:44:07 -0700
  • Thread-topic: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate

It stands to reason that if applicationShouldTerminated is called at all -
then it would have to be called before applicationWillTerminate is ever
called. After all, applicationShouldTerminated asks a question: the callback
is asking the delegate whether the application should quit or not. And
since there is no point in asking the delegate that question after the
matter has already been decided - we can safely conclude that
applicationShouldTerminate may be called only as long as
applicationWillTerminate has not been invoked. Because once the delegate
receives a applicationWillTerminate notification - the question
applicationShouldTerminated is asking (whether to quit or not) is no longer
a topic open for discussion.

Quitting gracefully is a much more involved process than simply responding
to these two callbacks, however. Therefore I would recommend reading the
"Graceful Application Termination" chapter here:

http://developer.apple.com/documentation/Cocoa/Conceptual/AppArchitecture/in
dex.html?http://developer.apple.com/documentation/Cocoa/Conceptual/AppArchit
ecture/Tasks/GracefulAppTermination.html

for a great deal more information.

Greg

On 5/25/06 11:52 PM, "JongAm Park" <email@hidden> wrote:

> Hello.
>
> I would like to terminate a thread when an application program quits.
> So, I tried checking when the "Quit" is invoked. One simple approach is
> to set a flag when applicationWillTerminate: or
> applicationShouldTerminate is invoked.
> I don't know which one is called first. So I put NSLog() into each method.
> It turned out that applicationShouldTerminated is called first.
>
> However, Apple's document says that they are called immediately before
> an application quit.
> So, I am not sure if the order of calling is always preserved, or
> sometimes it changes.
>
> Is the applicationShouldTerminated called before
> applicationWillTerminate always?
>
> Thank you.
> JongAm Park
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate (From: JongAm Park <email@hidden>)

  • Prev by Date: problem During Line drawing.
  • Next by Date: Newbie Q : Not-so-simple encoding&decoding example
  • Previous by thread: Re: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate
  • Next by thread: Re: [Q] which arrives earlier? applicationShouldTerminate or applicationWillTerminate
  • Index(es):
    • Date
    • Thread