Anyone seeing iOS11 issue with location services in background?

I have been testing on iOS11 beta versions between 4 and now 8 and I am sometimes seeing an issue where location services stop delivering GPS points when in the background. The logging that I have in the application isn't showing that any application delegate methods are firing, but the application seems to just go to sleep completely. No GPS is reported, nor core motion, etc. I have added the necessary entitlements for "Always On" that iOS11 requires as well, but the issue persists.

Replies

Yes. that is correct stoping and starting significant location changes solves this problem. However, my app has pausesLocationUpdatesAutomatically = true to save battery (but this value doesn't matter for the iOS 11 update bug). This solution worked fine for 11.2.5 update (so tested recently as well)


locationManager = = CLLocationManager()

locationManager.allowsBackgroundLocationUpdates = true

...

...

locationManager.stopMonitoringSignificantLocationChanges()

locationManager.startMonitoringSignificantLocationChanges()

locationManager.startUpdatingLocation()

That sounds promising!


We have a few phones that are not yet updated to the latest version (11.2.5), so we will give it a try and report back here.

Based on our tests we can confirm that this actually works - at least on Developer and Enterprise builds! We have not tested on a testflight build yet but we assume that the result will be the same.


Thank you asagri for finding the magic line! :-)


TLDR;

Fix == stopping significantLocationChanges and, in our case, monitoringVisits, following a start again.


We tested the following scenarios:


iPhoneX with iOS 11.2.1:

- Updated App with Developer build (with fix applied)

- Had Enterprise build installed (no fix)

- Had AppStore build installed (no fix)


  1. Test all builds before iOS update, ok
  2. Updated to iOS 11.2.5
  3. Developer build worked as before the update
  4. Both Enterprise and AppStore now failed as expected
  5. Updated Enterprise App (with fix applied)
  6. Developer and Enterprise builds now work
  7. AppStore still failed as expected


Sub-conclusion is that the fix solves the issue in both cases:

  1. Installing the App update before updating iOS
  2. Updating the App after updating iOS


iPhone 6s with iOS 11.1:

- Had newly installed Enterprise build (with fix applied)


  1. Test the App before iOS update, works.
  2. Updated to iOS 11.2.5
  3. The App still works


Sub-conclusion, the fix works with only one build of the App installed also


iPhone 6s with iOS 11.2.5 (the above phone):

- Had Enterprise build installed (with fix)


  1. Restored to iOS 11.3 beta 2. I wanted to test that an update to iOS 11.3 worked, but we did not have a phone with a previous beta version installed, so I was forced to do a restore. Will wait for the next beta to be released.
  2. Fresh Enterprise build installed (with fix)
  3. The App works


Sub-conclusion, the fix works on a fresh install with the upcoming iOS 11.3 (at least the beta!)


Overall conclusion, with limited setup and test scenarios though:

Since the error was present and reproducable in all types of builds of our App, and the suggested fix solves the issue in the Developer and Enterprise builds, we feel quite confident that the fix is a valid work-arround that will also work in the AppStore build.


If we see a difference behaviour in the AppStore version or when updating to iOS 11.3, we will of couse post it here!

Thanks for your tests and findings. I've implemented this in my App as well, but could not yet test this by installing system updates.

Downgrade to iOS 10 or 10.3 works best

I too confrim that this fix works. I tested in 4 devices for 3 days. I did the update and no restart afterwards. I had two versions of the app installed on all devices and I put the fix in one of them. The app with the fix worked fine even after the iOS update and the other app kept appearing the bug of no location updates when it's in the background.


@asagri thank you very much for your fix. I will keep testing it.

My app works with significant as well as normal updates.


So I have used this, when normal updates are required:


locationManager.stopMonitoringSignificantLocationChanges()

locationManager.startMonitoringSignificantLocationChanges()

locationManager.startUpdatingLocation()


and this, when significant updates are required:

locationManager.stopMonitoringSignificantLocationChanges()

locationManager.startMonitoringSignificantLocationChanges()


Will post the results/conclusions here.

This work-around did not appear to resolve the issue for me after updating to iOS 12…