title: applicationWillTerminate when is it called and when not
body: <p>Hi I have read several questions on SO about applicationWillTerminate getting called and not getting called.</p>
  
  <p>I wanted to summarize what I understood as there are several posts that speak differently.</p>
  
  <ol>
  <li><p>For IOS (without multitasking) it is called always when home button is pressed.</p></li>
  <li><p>For IOS 4 and above</p>
  
  <p>a. it is <strong>not</strong> called when pressing home button (as the app moves to background)</p>
  
  <p>b. it is called when closing the app from the multi tasking dock and if the app has a sudden terminate flag in info.plist disabled else it is not called. <strong>( I set the "Application should get App Died events" and even then on closing the app from the multitasking dock the terminate function did not get called)</strong></p></li>
  </ol>
  
  <p>Based on that I had a couple of questions</p>
  
  <p>Is it a good practise to set the Application should get App Died events flag? ( I set the "Application should get App Died events" and even then on closing the app from the multitasking dock the terminate function did not get called)</p>
  
  <p>or</p>
  
  <p>Is registering for "UIApplicationWillTerminateNotification" a better thing to do than the info.plist setting?</p>
  
  <p>Basically I need to do some work only when the app terminates and NOT when it moves to background.</p>
  
  <p>or</p>
  
  <p>EDIT (1): 
  When the app is terminated the following is sent to the APP. How do I catch it?</p>
  
  <p>Program received signal:  “SIGKILL”.</p>
  
  <p><strong>EDIT (2):</strong></p>
  
  <p>Please note : It is not getting called in IOS 4 and above when removing from the multitasking dock. You might think it is. But in my case it is not.</p>
  
  <p>I am asking if anyone knows why? Is there something else I am missing. </p>
  
  <p>Also Note I set the "Application should get App Died events" and even then it is not getting called.</p>
  
  <p><strong>EDIT (3):</strong></p>
  
  <p>The answer for the following question also did not work.
  <a href="https://stackoverflow.com/questions/4320557/applicationwillterminate-does-not-get-invoked">applicationWillTerminate does not get invoked</a></p>
  
  <p>Anybody facing the similar issue as me?</p>