IPhone - fast switching applications and iOS 4

I am trying to get the following functions in my iPhone application:

  • With background setting, remains (no background work needed)
  • When resuming, the application chooses where it was stopped.

I basically want the same screen in my application to still work, as there are several UINavigationControllers in the UITabBarController.

I have completed all of the following:

  • Make sure I compile with 4.1 SDK
  • Set UIApplicationExitsOnSuspend to false
  • Pen DidEnterBackground and WillEnterForeground in my AppDelegate
  • Call BeginBackgroundTask in DidEnterBackground to try to open my application.

I use MonoTouch, but probably it is not. I can take the answers in Obj-C, of ​​course.

I tested my application on a jailbreak phone with Backgrounder, and I see that the “app in the background” icon disappears immediately after pressing the “home” button. I also tried installing UIBackgroundModes in my Info.plist, but to no avail.

Is there anything I don't see?

Or is it something that I would have to implement myself to resume the previous state of my application? Wherever I read conversations, this should just work automatically.

+4
source share
4 answers

I finally got in touch with someone on MonoTouch irc.

MonoDevelop has the ability to make the dual iPad / iPhone project that I used. This causes my application to behave as if it works with SDK 3.2 when deployed to it.

I think my solution is to install the iOS 4.2 SDK, which has just been released, as this is an advertisement for the new multi-tasking feature on the iPad.

+1
source

If you do not want to run in the background, do not call beginBackgroundTask. This call is intended for situations when you want to do some work in the background. And if you don’t finish this work fast enough, iOS will terminate your application.

+1
source

When I upgraded to iOS 4.x, my MT app started showing this behavior without me. iOS should take care of it for you.

+1
source

You need to not only support background features, but also support cases when your application has been interrupted. In the application initialization code, you must resume the state in which it was. For example, when you press the view controller, use NSUserDefaults to store the value for the screen that is currently displayed, and then when you start reading that value and display the corresponding screen.

0
source

All Articles