iPhone app reactivate (open from icon) - iphone

In the latest iOS, apps now "deactivate" rather than close by default. So the app retains state and stays in memory.
I want my app to reset its state when it's reactivated, just like when it's closed/opened on iPhone 3.
I suspect reactivate is the wrong word! But hopefully you know what I mean.
thanks

Add the UIApplicationExitsOnSuspend key to your Info.plist, and set it to YES. This will mark your application as NOT supporting multitasking, and it will quit just like it used to. Good luck!

You can opt out of multitasking by setting the UIApplicationExitsOnSuspend key in your project’s Info.plist and setting the value to YES.
This will make your app behave like it would on iOS 3.x.

There's a property list key for that. UIApplicationExitsOnSuspend is set in your Info.plist when you want to exit instead of suspend when the user hits the home button.

If you have an app that you developed pre-multitasking and you are having issues or you don’t need it, you can disable multitasking in the application’s Info.plist file.
Adding
Application does not run in background
or
UIApplicationExitsOnSuspend
will stop your application being suspended when it is closed.

Related

How to turn Off iPhone application when enters in background?

I have made an iPhone application.
When my application enters in background.
I want to turn off fully my iPhone application,and when i again start my iPhone application it should starts from the starting page,it should not start from where i left.
I have used exit(0),but i think it is not recommended by Apple.
Please provide some suitable solution soon.
You can achieve it by modifying your info.plist file.
add this Key "Application does not run in background" and set its value to "YES"
This should get you going!
Let me know if it solves:)

How to stop running iphone app in background in iphone sdk 4.0 and above

Please tell me some solution for how to stop app at background when we close the app in iphone sdk 4.0 and above.
can any one provide me some sample code for it.
Thanks,
Priyanka
Set the UIApplicationExitsOnSuspend key in your app's Info.plist to YES.
This will make the app quit when you press the home button, instead of being backgrounded.

How to disable fast application switching (multitasking) on iOS 4?

In iOS 4, when a user presses the Home button, the running app will save the current state and go to background. However I'm developing an app and I don't want it to go to the background. I want it to kill itself, just like in iOS 3 and before. How can I do it? Thanks.
See "Opting Out of Background Execution" in the iOS Application Programming Guide:
"...you can explicitly opt out of the
background execution model by adding
the UIApplicationExitsOnSuspend key to
your application’s Info.plist file and
setting its value to YES."

iPhone - fast-app switching and iOS 4

I'm trying to get the following functionality in my iPhone app:
When backgrounded, stays running (doesn't have to do any background work)
When resumed, app picks up where it was left off
I'm mainly wanting the same screen on my app still up, as there are several UINavigationControllers within a UITabBarController.
I have done all of the following:
Made sure I'm compiling with 4.1 SDK
Set UIApplicationExitsOnSuspend to false
Handle DidEnterBackground and WillEnterForeground in my AppDelegate
Call BeginBackgroundTask in DidEnterBackground, to attempt to keep my app open
I'm using MonoTouch, but that it probably beside the point. I can take answers in Obj-C, for sure.
I've tested my app on a jailbroken phone with Backgrounder, and I see the "app in background" badge disappear immediately after pushing the home button. I also tried setting UIBackgroundModes in my Info.plist, but to no avail.
Is there anything I'm missing?
Or is this something I would have to implement on my own to resume the previous state of my app? Everywhere I've read talks like it should just work automatically.
If you don't want to be doing work in background, don't call beginBackgroundTask. That call is for situations where you want to do some kind of work in the background. And if you don't finish that work fast enough, iOS will terminate your app.
When I upgraded to iOS 4.x, my MT application started exhibiting this behavior without me having to do anything. iOS should take care of it for you.
I finally got in touch with someone on MonoTouch's irc.
In MonoDevelop there is an option to make a dual iPad/iPhone project, which I used. This is causing my app to behave as if it's running with the 3.2 SDK when deployed to the device.
I think my solution is to install the iOS 4.2 SDK that just came out, since this ads the new multi-tasking feature on iPad.
Not only do you need to support going into the background, you also need to support cases where your app has been terminated. In your app’s initialization code, you should resume the state that it was in. For instance, when you push a view controller, use NSUserDefaults to store a value for the currently-displayed screen, and then when you start read that value and display the associated screen.

Is there a way to forbid multi-tasking in iOS 4?

I want my app to quit when the user taps the home button, without going to the background. Is this possible?
Set the key UIApplicationExitsOnSuspend to true in your info.plist. See the docs.