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
source
share