开发者

iOS4 removing app from memory via code

Is there a way (with iOS4) when the user hits the home button (in order to exit an application) to convey to the iOS4 system to not keep the app running in the background but to remove the app completel开发者_运维百科y from memory (like iPhone 3)? My app could potentially display sensitive information and I'd like for it to exit completely.

Thanks


Try adding "Application does not run in background" too the pList, I added this to one of our app and it seems to start it from scratch every time..although it still keeps in task manager. So aslong as your app handles the clearing of memory you should be fine.


You need to set the key UIApplicationExitsOnSuspend to YES in your application's info.plist.


You could also just modify your app so that in applicationDidBecomeActive: you could detect if you are displaying sensitive information and if you modify the view so either you aren't or that you go to some other screen that is more appropriate.

There are many other places that you could put code to be notified of transitions between active and inactive and you could modify your view in any of those places so that you are no longer showing sensitive material. This would allow you to still retain the other benefits of having your app in memory (like faster load times).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜