Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating locations while app in background working on simulator but not on device (iOS 9)

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.

like image 260
AppsDev Avatar asked Sep 23 '15 13:09

AppsDev


People also ask

How to get location in background iOS?

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.

How do I get a background location update every n minutes in my IOS application?

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.


1 Answers

With iOS 9 you also need to set allowsBackgroundLocationUpdates to yes. See the docs here

like image 60
rmp Avatar answered Oct 02 '22 12:10

rmp