4

i wrote an application on the Xcode 4.2 using iOS SDK 5.0.

i have set the UIApplicationexitonsuspend in the info.plist to YES but when i double press the home button, the application is still in the multitasking bar.

i have deleted the app from my iPhone 4s and resend it again from Xcode but still the exit on suspend does not work. application still lingers on multitasking tab.

at0m87
  • 245
  • 1
  • 3
  • 16
  • 1
    Just because the application is in the bar doesn't mean it's still running. Is `applicationWillTerminate:` being called? – Frederick Cheung Dec 26 '11 at 15:51
  • 1
    @FrederickCheung yes applicationWillTerminate: is called. if you could also give an answer for the comment i posted under the answer given by sergio it would be of great help. thanks! – at0m87 Dec 26 '11 at 20:58

3 Answers3

4

The fact that your app icon is shown in the "multitask tab" does not mean that your app is still there.

The "multitask tab" simply shows a list of all the apps that you have run.

A simple way to assess if an app is launched anew when you touch it, is by doing the following steps:

  1. launch your app;

  2. close it by pressing the home button;

  3. relaunch the app and inspect the image that it shows on startup. If this image is your "Default.png" image, then the app was launched anew. If you find your app in the state you left it, then the app was simply made active again (i.e., it was in the background).

A more advanced way to see what happens when you launch your app is put an NSLog trace in your app delegate methods:

- (void)applicationDidEnterBackground:(UIApplication *)application {
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
}

If you will see the traces printed out, then it means that the app was not quit on suspend.

Conversely, you could put a trace in:

- (void)applicationWillTerminate:(UIApplication *)application {
}

if it is called when you press the home button, then the app does not enter the background state, rather it quits.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • Okay, point noted! i tried it and it is as you have said.! thank you for pointing it out to me. but i am puzzled why the app, even thou it has exited and no longer running, still lingers on the multitasking tab masquerading as an app still running in the background? Because logically speaking, being in the multitasking tab bar means it is still running in the background. so logically it doesn't make sense to see it still there but i know it is no longer running - proof from the debugger. – at0m87 Dec 26 '11 at 20:55
  • I see your point. I think this is simply Apple trying to give the user the feeling that all apps are multitasking-aware, even when they aren't. It is for all accounts easier to understand for the end user. But this is just my guess... – sergio Dec 26 '11 at 21:22
  • Thank you for your response. by saying that, you are saying there is absolutely no way a programmer can make his application disappear from the multitasking bar because this is Apple's way? sorry if i seem a little buggy with questions, i am a very curious person =) – at0m87 Dec 28 '11 at 15:12
0

If you want that your app will not run in background mode. Do the following:- Open your application info.plist and then add another attribute it it:- "Application does not run in background mode" and make sure that check box is checked for this attribute. Now save , rebuild and run your app again. By doing this your app will not run in background mode.

Sandeep Dhama
  • 614
  • 1
  • 6
  • 20
0

"Application does not run in background mode" and "UIApplicationexitonsuspend " are the same key

Apps 4 U
  • 239
  • 4
  • 16