Are terminated apps removed from the app switcher? - ios

If an app is suspended and the system decides to terminate it, is it removed from the app switcher or does the app switcher retain a snap shot of the app as if its still suspended?

It will stay there until the user swipes up to kill it. When the user returns to the snapshot of a killed app it will simply relaunch.

Apps terminated by iOS are not (normally) removed from the app switcher. However, if the user swipes up on the app to remove it from the app switcher, that app is (normally) also terminated.
I say "normally" because Apple does not document this behavior and may be subject to future changes. But this is how the app switcher currently appears to behave.

Related

iOS App Woken into Background from Termination, then Launched into Foreground by User

imagine an app uses background Bluetooth services and gets woken into the background from the terminated state. now while it's running in the background then...
Situation 1: the user taps a message notification to launch the app into the foreground.
does iOS call willFinishLaunchingWithOptions:? it must, otherwise there's no way to deliver the UIApplicationLaunchOptionsRemoteNotificationKey to the application. but does this involve terminating the running backgrounded app and then restarting it? or calling this method on an already running app?
Situation 2: the user taps the app icon to launch the app into foreground
i could imagine iOS just calling applicationWillEnterForeground here. but maybe it terminates and reboots the app?

Launch app in background when BLE device is in range

I'm making an iOS app to support a Bluetooth LE device. First time the app launches, we pair, but after that I want to communicate with the device whenever it is in range. Using background modes, this works fine for when the app is launched and goes into background and the screen is turned off. But, when the phone is rebooted, the app needs to be relaunched before it will be able to detect the device.
Is there any way to have the app launch in the background whenever the BLE device that it is paired to comes nearby?
In case of user forcibly kills the app by double clicking on home button and swipe out, it will not be relaunched until the user launches it again.
Coming to your case when Device is rebooted - Yes, you can configure State Preservation and Restoration to relaunch the app when user has not killed it forcibly before rebooting.
( Note: If the device requires a passcode to unlock, apps will not be relaunched until the device is unlocked for the first time after a restart )
Also, it is important to keep in mind that the app will be relaunched and restored if and only if it is pending on a specific Bluetooth event or action (like scanning, connecting, or a subscribed notification characteristic), and this event has occurred.
For more info:
Conditions Under Which Bluetooth State Restoration Will Relaunch An App

Debugging killed app in xcode debugger(Notification Debugging)

My notifications is crashing the IOS App when the user clicks the notification after the app was killed and removed from the background/foreground. I don't know how to get debugging information if the app isnt being ran.
You need to edit your scheme, choose Run on the left bar. and Info on the top tab bar.
Change Launch to wait for executable to be launched.
Now, you can run the app. the app will not launch and therefore, will not crash.
get the notification, open it, and debug the crash.

How to run watch app on background mode location update

I was using location updates as background mode on Apple Watch series 2..
my issue is when I removed app from dock or foreground. my app is again re-launching to foreground after unlocking watch.
But I don't want to re-launch app automatically until user manually re-launchig the app. How I can achieve this...
is their any way to handle this...

UIApplicationExitsOnSuspend and screen refresh

I have an app that has the UIApplicationExitsOnSuspend info list property set to TRUE.
And now I am noticing a curious issue.
I start up the app and let it run on my phone and do not touch my phone. Eventually the phone screen goes dark and the phone goes into standby mode. When I wake the phone up, what I see is a screenshot of the last screen displayed on the app. (This seems according to spec, since the Apple documentation says that in the process of moving an app to the background, ios takes a picture of the app and uses that for transitions when the app comes back to life). If I double click on the home button to see running apps, I do not see an instance of the app running. (again, working as intended since UIApplicationExitsOnSuspend is set to true).
My question is, how do I make sure that when the phone wakes up, it comes back to the default home screen and not the picture of the app ? Clearly the app is not running on waking up, so there is nothing I can do from within the app that will refresh the screen. I could try to exit when the app is going to background, but then apple guidelines say, never exit programatically!!.
Any ideas ?
You misunderstand what is happening. If you enable UIApplicationExitsOnSuspend, this means your app will terminate when normally the app would go to the background. If you run your app then let the phone sit idle until the screen goes dark, your app is still in the foreground so it is not terminated. When a device goes into standby mode, the current app is still the current app. When you wake the device, you are not looking at snapshot of your app, you are looking at your running app. Double-tapping the Home button at this point doesn't show your app because your app is the currently running app.
Your app will be terminated if you return to the home screen or switch to another app. But it will not terminate just because the device went into standby mode.
If you want your app to return to its main screen when the device is woken up, then you need to put code in the UIApplicationDelegate applicationDidBecomeActive: method to reset your user interface.

Resources