Core Location not running in background

I have checked both of the following:

  • Background Modes - Location updates
  • requestWhenInUseAuthorization (also tried always on)


The location services works fine when the app is in the foreground however when the phone is in sleep or pressing the home button causes it to stop.


I have also noticed that the blue banner '%MyApp% is Using Your Location' is not showing either.


I am using iOS9 beta 2 and Xcode 7 beta 2.

Replies

In iOS 9, for your app to continue getting location updates while in the background, in addition to all of the above you have done, you now need to set the allowsBackgroundLocationUpdates property of your location manager to YES.


This property now allows apps to selectively and pre-emptively opt in/out of background location updates dynamically as needed in your app.

The default value is NO. If you want your app to behave like it did before, you need to set this property to YES when you initialize your location manager.


This, and other new features in Core Location is explained in the WWDC 2015 session 714. You can watch it here: https://developer.apple.com/videos/wwdc/2015/?id=714