SO, let me start by sorting out a few specific details: delegate is called via applicationWillTerminate which will then again almost immediately end in the app receiving a SIGKILL. applicationWillTerminate is not part of the normal delegate lifecycle. It's a relatively late “add-on that was recycled[1] to give apps SOME opportunity to save work if/when the user for quit them, so it's ONLY called if the app happens to be a wake at the point it's terminated by the user. Most critically, you cannot do ANY work after receiving it. That's because: Your app will call exit() immediately after returning from it. If you block “too long, then the system will kill you anyway. In practice, that means it needs to be handled as a separate edge case as you don't really have a lot of time or flexibility to do significant work. This is not your app being closed in the normal sense, it's actually your app being force-quit by the user. With that out of the way, the important case is actually applicationDidEnterBackground, so le
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags: