Reasons why iOS will terminate an app

697 Views Asked by At

We have a GPS tracking type iOS app which runs in the background. We are seeing infrequent cases where the app appears to be getting terminated with the applicationWillTerminate method being called while the tracking process is taking place.

We have more or less ruled out low RAM as the reasons. Also definitely not a battery level issue or users terminating the app.

Any suggestions what would be the next most likely causes for iOS to terminate the app?

Some thoughts we had were CPU usage, phone temperature level or simply because the app is running in the background for extended periods (e.g. days or weeks).

Are any of these likely or even possible causes for iOS to terminate the app?

1

There are 1 best solutions below

0
Smartcat On

From Apple's Background Execution docs:

Do minimal work while running in the background. The execution time given to background apps is more constrained than the amount of time given to the foreground app. Apps that spend too much time executing in the background can be throttled back by the system or terminated.

Also, I assume you've verified you're not running afoul of the below (from the same doc):

Each call to the beginBackgroundTaskWithName:expirationHandler: or beginBackgroundTaskWithExpirationHandler: method generates a unique token to associate with the corresponding task. When your app completes a task, it must call the endBackgroundTask: method with the corresponding token to let the system know that the task is complete. Failure to call the endBackgroundTask: method for a background task will result in the termination of your app.