Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing an iPhone app to quit when Home button is pressed (on iOS4)

I do not want my app to switch to the "task bar" when the Home button is pressed. That's why I would like it to be closed upon Home press. I added this entry to the info.plist file but this does not change the behaviour:

application does not run in background

(and I checked the box...)

I rebuilt the whole app both in debug and release mode but no way. I heard of another key which should be added to the info.plist but I cannot add it through Xcode:

UIApplicationExitsOnSuspend

What is the right way to do that ?

Regards,

Franz

like image 382
user255607 Avatar asked Nov 19 '10 15:11

user255607


People also ask

Can you force stop an app on iPhone?

To quit the app, open the App Switcher, swipe right to find the app, then swipe up on the app. To reopen the app, go to the Home Screen (or App Library), then tap the app.

How do you force close apps on iPhone without home button?

Force reset: Quickly tap the volume up button, then the volume down button, then press and hold the side button.

How do you close apps on iPhone with home button?

Step 1: Double click Home key to open the multitasking interface in which you will see your recently used apps. Step 2: Swipe left or right to find the app you'd like to close. Step 3: Swipe up to close the app or swipe up with two or three fingers to close multiple apps.

How do you force quit an app on iPhone 11?

iPhone X and laterFrom the Home Screen, swipe up from the bottom of the screen and pause in the middle of the screen. Swipe right or left to find the app that you want to close. Swipe up on the app's preview to close the app.


2 Answers

On iOS 4, multitasking is enabled in Xcode projects by default. This prevents the applicationWillTerminate method from being called. If you do not want to support multitasking, place UIApplicationExitsOnSuspend in your MyAppName-Info.plist file and check the checkbox. If you do want to support it, place any code in the applicationDidEnterBackground delegate method that you want to execute before the application enters an inactive state.

like image 78
Evan Mulawski Avatar answered Sep 28 '22 00:09

Evan Mulawski


What you're doing will indeed stop the application from running in the background, but you can't prevent it from going to the multitasking bar still. Sorry.

like image 33
Pripyat Avatar answered Sep 28 '22 00:09

Pripyat