I have enabled Background Modes > Location updates
in my target's capabilites. I run the app in an iOS 9
simulator, I put the app in background state with Location > City run
in the simulator, and it seems to keep getting location updates. But I run the app in a real iOS 9
device and few seconds after going to background, I loose the location services arrow in the status bar and no location updates are received.
On the other hand, I've run the app in a real iOS 8
device and it seems to keep listening for locations (the arrow in the status bar does not disappear).
Why are location services stopping in background in an iOS 9
real iPhone
?
I need help to solve this, thanks in advance.
Tell the system you want background updatesSet the allowsBackgroundLocationUpdates property of your location manager to true to enable background updates. Set the showsBackgroundLocationIndicator property to true if your app has Always access to let people know when you're using location services in the background.
You can use an NSTimer to request a location every minute with this method now and don't have to work with startUpdatingLocation and stopUpdatingLocation methods.
With iOS 9 you also need to set allowsBackgroundLocationUpdates
to yes
. See the docs here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With