开发者

Reinitializing iPhone app when it relaunches

I am building an iPhone app. Currently when I close the app and relaunch it, it relaunches on the last viewed view. Instead I want to be able to reinitialize the app, and present the view that's most appropriate for the application's state (based on what's in the database).

How can I do t开发者_运维知识库hat?


You have two options. You can follow Petesh's suggestion to make your app always terminate, or you can implement -applicationWillEnterForeground in your app delegate and reset things there.


I presume it's iOS4 - your app is not being terminated in this case, it is merely being suspended.

You need to follow the instructions here: http://maniacdev.com/2010/07/screw-multi-tasking-how-to-make-your-ios-4-apps-exit-for-real/ which will terminate the app when the user presses the home button.

You need to add the appropriate 'correct view' logic to your application's start-up code once you've done this.

For the purposes of expediency, I'm adding the instructions here:

  1. Open your info.plist file
  2. Add The Key UIApplicationExitsOnSuspend or Select Application does not run in background
  3. Set the new key to YES or Fill in the tick box
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜