Iphone - how to handle exceptions (signals?)

In my iphone application, I want to provide some kind of application completion handler that will do some final work (delete some sensitive data) until the application terminates.

I want to handle as many completion situations as possible:
 1) The user terminates the application
 2) The device is exhausted from the battery
 3) The system terminates the application for some reason (for example, due to lack of memory or application)

 4) Application crashes (EXC_BAD_ACCESS or SIGSEGV )

Any other exception?
What is the best way to achieve this (e.g. the applicationWillTerminate method called in situation 2)?
Is it possible to perform a cleanup in a signal handler (including calls to the iPhone security infrastructure)?

considers

+5
source share
1 answer

This timely post will help you with 4) start with.

You know when your application will stop working with your application delegate and you will be able to listen to battery change notifications, see UIDevice .

+1
source

All Articles