Search code examples
ioscocoa-touch

Which Event When i close app in iOS?


I need to implement event when i close my app in iOS like following pic.

enter image description here

I want to catch that event when i close app with that minus button.

Which event i need to do?


Solution

  • This delegete will be called when your application is going to terminate.

    - (void)applicationWillTerminate:(UIApplication *)app
    {
    }
    

    If you are using iOS 4 or greater and with multi-tasking support, applicationWillTerminate will not be called.

    For receiving the terminate event you need to add UIApplicationExitsOnSuspend key on your info.plist

    Check this article for a good understanding about application events.

    Without mutitasking

    With mutitasking