Search code examples
iphoneios4notificationspushterminate

iOS4: application termination event?


I would like to know how i can detect when an application is about to be terminated. I mean really terminated, not just going into background mode. I have used this event, and it doesn't fire :

applicationWillTerminate

What i would really like to achieve is get some kind of event or notification when the user taps Home twice and presses the red baloon on the app. I don't care about the application going into background mode, there are a couple of events that handle this properly and they all work fine.

I need this so that i can "inform" my server to stop sending push notifications to APNS for apps that are terminated and aren't running in the background.

If you know of an easier way to achieve this, i'd be glad to hear :)

Thank you


Solution

  • Angel, what you're asking for cannot be done. The app will be terminated with SIGKILL. Unstoppable, not catchable, no notifications. There is no difference between a system-initiated termination or one requested by the user.

    You'll get applicationWillTerminate only if your app doesn't support background processing.