App running in background despite plist saying not to - iphone

In my appname-Info.plist
I have 'Application does not run in background' box checked.(it is ticked)
But when i press the button under the screen to close the app, and then double press the button it shows the list of apps and my app is there among the list of currently running apps. Does this mean that my app is running in the background?
If so is there a fix for this? I'd like to make sure my app is completely dead when user quits it.
Thanks
-Code

Your app is not running in the background after you close it.
Even if you see it in the switcher app list.
Application has different states
Active
InActive
Running in Background
Your application become in-active, not running in background.
Aplications are allaowd to run in the background only for:
Playing music.
Navigation needs.
VOIP (as Skype).
And you should explicitly ask the permission and set the appropriate code for doing that and not only check the 'Application does run in background' in the info.plist

The list you get when you double tap the home button is not a running applications list. That's a common misconception. It's actually a list of recently launched applications. Therefore it makes sense for your app to be in it even if it doesn't multitask.

Related

Application does not run in background mode

I have set "Application does not run in background mode" property key to YES and when I hit the home button it only puts the application into background mode when I click home button twice the app is still running in background and when I relaunch the app the application will enter foreground method is called . I have a setting bundle that creates tabs for UITabBarcontroller and I want the app to quit as it need to run the setup method to work out which tabs to show . I tried to use application will enter foreground to remove view controllers from the tabbar controller by reading the settings bundle and it works but the application will enter foreground method is no good as I can not re-add the view controllers I removed if the settings are changed back again so my only option is to quit the app and the application did launch with options method alloc and init all view controller b reading the setting bundle first . Is there any other way to quit the app
The fact that your app's icon is listed once you double press the Home button is not indicative that it is running. At best, it indicates which apps the user used last.
"Running in the background" and "loaded into memory, ready to resume" are not the same thing. It's a bit similar to how you can shutdown a computer (it's not processing anything), and if put a computer to 'sleep', it's still not processing… but the state of the computer is kept.
I would invite you to read the suspended and background states : App States and Multitasking.

iPhone - Sending the app to the background

In my app, when it runs for the first time, it shows a UIViewAlert and offers you to see the preferences for the app - and the user has 2 choices - yes or no. If the user hits no the alert fades away and the application continues running. I want to set it in such a way, that if the user hits yes, my app will go to the background, the settings tab of the app will be opened (I added a settings bundle to the app). Is it possible to do such a thing? Thanks!
No, this is not possible. But you can create a settings view in you app and show it instead of trying to open the settings app.
Normally, you do want to encourage users to use your app as long as possible, and making them quit your app yourself is not the best way to achieve that.
No, this isn't possible.
But you could use InAppSettingsKit and modally show a view controller with the settings inside the app.
You can find out more here - http://www.inappsettingskit.com/

What does double-tapping on the home button exactly do?

What does double-tapping on the home button exactly do?
Does it list the applications running in background, OR
Does it list recently used applications?
I've implemented the "Application does not run in background" in my Info.plist file. In spite of this my application shows on double tapping the home button !! Yes I have tried a clean build.
It shows all recently-used apps, not just the multi-tasking ones. If you try to tap your app now, it will start exactly like it was first launched, displaying the launch image first before initializing (calling application:didFinishLaunchingWithOptions: and sending the relevant notifications).

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 that?
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:
Open your info.plist file
Add The Key UIApplicationExitsOnSuspend or Select Application does not run in background
Set the new key to YES or Fill in the tick box

When i kill the application in multitasking bar,and run the program it's goes to same state where i was closing the app

Today i updated my 3GS i-phone to install my application to see it's functioning well in OS4,when i'm running the application and tap the home button it's goes to multitasking bar,then again i get the application from there it's goes to previous state where i was.i think the behavior is OK. but problem comes when i kill the application in multitasking bar and run it it's come to same state,simply it's ignore the login screen.
My question is when i kill the application i want to get my login screen, not the previous state, this application is working fine in 3GS,can some one please help me to fix this issue?
Thanks
Sam.
Sam,
If you don't want the OS to save state for you, you should place the key UIApplicationExitsOnSuspend in your info.plist file.
More information here: http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW23
This will kill the app when the home button is pressed, instead of suspending it into the background (which is what iOS4 does for multi-tasking).