开发者

Is there a catch all method one could use to reset iPhone app when user exits?

Just wondering:

Basically my app runs fine until the user exits and then tries to go 开发者_运维知识库back in. My app doesn't involve anything to be saved or stored for the future. It would be great if there was a method that when the user exited (when they hit the physical exit button) the app was just cleared out and was ready to be launched again as if nothing had every happened.

Any ideas?

Thanks,


Assuming you've made sure your application doesn't persist anything, all you have left to do is add UIApplicationExitsOnSuspend and set it to true in your application's Info.plist. The moment the user leaves your application, its process will terminate. When the user starts your application again it won't remember anything; it'll just start from the beginning. This includes displaying the launch image.


There is no way to really do this, but you could feign it by putting some logic in your AppDelegate's applicationWillEnterForeground: method. In this method, you would just do any necessary steps to reset the application back to an initial state.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜