iOS 16.4. Unable to Run in the Background Even with Always Allow Location Permission Enabled

Recently, I found that our application can only run in the background for a short time and then gets interrupted by the system, even after enabling Always Allow Location and Background Running Permissions. This has caused me a lot of frustration because I need this application to run in the background constantly to track my location and other information.

Before version 16.4, this application could run in the background for a long time, even exceeding 24 hours. However, in the 16.4 test version, the background running time is limited to no more than 10 minutes, which makes it impossible for the software to run properly in the background.

Post not yet marked as solved Up vote post of lifubing Down vote post of lifubing
2.5k views

Replies

I've been testing iOS 16.4 on iPad since day 1 and it runs in background location 24x7, I specifically and continuously test for this use case. Are you sure this is not some kind of crash that would be happening after these 10 minutes that might be bringing the app down? There might be differences between location services on iPad and iPhone though.

  • It's unlikely to be caused by app crashing, as other background running apps on my phone are experiencing the same situation.

Add a Comment

Are you using showsBackgroundLocationIndicator = false or showsBackgroundLocationIndicator = true? Are you calling startUpdatingLocation() when the app is foregrounded or backgrounded?

I filed a bug report: https://feedbackassistant.apple.com/feedback/12082689

Before iOS 16.4, we could reliably start CLLocationManager in the background (for example, in response to a CLCircularRegion exit or a CLVisit arrival) by calling startUpdatingLocation(), and keep it running indefinitely, assuming we had "Always" location permissions and the "Location updates" background mode. As of iOS 16.4, this no longer works reliably if the CLLocationManager is started when the app is backgrounded and showsBackgroundLocationIndicator = false. It does still seem to work if the CLLocationManager is started when the app is foregrounded and showsBackgroundLocationIndicator = true. We have seen a few similar reports on the developer forums: https://developer.apple.com/forums/thread/727015 https://developer.apple.com/forums/thread/726945 Did this behavior change in iOS 16.4? Thank you.

Add a Comment

The issue that is described here due to the changes with iOS 16.4 (and above) which affect the behavior of apps tracking location in the background.

Beginning in iOS 16.4, apps calling both startUpdatingLocation() AND startMonitoringSignificantLocationChanges() may get suspended in the background if they are specifying low accuracy and distance filtering in the location manager settings.

If your app needs only low accuracy locations of kCLLocationAccuracyKilometer and up, use startMonitoringSignificantLocationChanges() for that purpose instead.

If your app requires continuous high accuracy locations in the background, you must set the following location manager properties:

  • allowsBackgroundLocationUpdates must be set to TRUE or YES
  • distanceFilter must not be set, or set to kCLDistanceFilterNone
  • desiredAccuracy must be kCLLocationAccuracyHundredMeters or better. If you’re using numeric values, it must be set to less than 1000 meters

Alternatively you can turn on the location indicator which will avoid the issue. You can do this by setting

  • showsBackgroundLocationIndicator to TRUE or YES

If you implement the above changes in your app, its location update behavior will be similar to behavior prior to iOS 16.4. Without these changes, your app may not be able to receive continuous background location updates.

[@Gualtier Malde](https://developer.apple.com/forums/profile/Gualtier Malde) @lifubing Is this issue present in iOS 17 too? Seems iOS 17 works similar to the versions below iOS 16.4