Location tracking in background

Hi,


are there any new requirements for background location tracking in iOS9?


Got problems with my new walking app on iOS9 devices:

Tracking starts normal in foreground, but if I switch the app to the background the location updates and also the time tracker stops until the app is switched back to foreground. This happens only on my iOS9 test device. Same project is running fine in the background on iOS8 devices and also running fine on the iOS9 simulator.

Also the project is running fine when I am compiling the project with xcode 6.3.2 against iOS8.


As always when I got such issues, I have created a simple test app which is logging time and distance in the log, this test app reproduces the issue.

The test app can be downloaded as a zip at this url: www.ihanwel.com/export/test.zip


Any idea? Maybe someone has some time to compile my test app and check it on the own device.

Thanks.


Cheers,

Hanno

Answered by awgeorge in 10869022

Hey Hanno,


iOS 9 Has made a few changes to the way Location Services run in the background. Most prominent - you now have to request further access. Set `allowsBackgroundLocationUpdates` when you want to recieve background updates.


if([self.locationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates)]){

[self.locationManager setAllowsBackgroundLocationUpdates:YES];

}


Discover more: https://developer.apple.com/videos/wwdc/2015/?id=714


W

Accepted Answer

Hey Hanno,


iOS 9 Has made a few changes to the way Location Services run in the background. Most prominent - you now have to request further access. Set `allowsBackgroundLocationUpdates` when you want to recieve background updates.


if([self.locationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates)]){

[self.locationManager setAllowsBackgroundLocationUpdates:YES];

}


Discover more: https://developer.apple.com/videos/wwdc/2015/?id=714


W

Thanks, that was very helpfull.


Cheers,

Hanno

Location tracking in background
 
 
Q