iphone - how to properly handle exceptional situations (signals ?)

Posted by pmilosev on Stack Overflow See other posts from Stack Overflow or by pmilosev
Published on 2010-05-17T12:16:50Z Indexed on 2010/05/17 12:20 UTC
Read the original article Hit count: 213

Hi

In my iphone app, I want to provide some sort of app termination handler that will do some final work (delete some sensitive data) before the application terminates.

I want to handle as much of the termination situations as possible:
1) User terminates the app
2) The device runs out of battery
3) The system terminates the app due to some reason (e.g. out of memory or app freeze)
4) Application crashes (EXC_BAD_ACCESS or SIGSEGV)

Any other exceptional situation ?
What is the best way to achieve this (e.g. is applicationWillTerminate method called in situation 2) ?
Is it possible to do the cleanup in a signal handler (includes iPhone Security framework calls) ?

regards

© Stack Overflow or respective owner

Related posts about iphone

Related posts about signal-handling