开发者

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

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 s开发者_开发知识库ituations 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


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

You know when your app is going to terminate from your app delegate and you can listen for notifcations to battery changes, see UIDevice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜