When CLLocationManagerDelegate methods are called?

198 Views Asked by At

I am using iOS8 and trying to track location(latitude and longitude) values. I needed clarification about when CLLocationManagerDelegate methods are called.

1)Will it be called only when app is in foreground along with locationchange OR

2)Will it be called when app is in background along with locationchange OR

3)In both the above conditions.

I just wanted to know/clarification about whether - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations is called even when app is in background along with locationchange OR only when app is in foreground along with locationchange OR in both conditions?

I have not enabled Location Updates Background Modes.I am using iOS8 and made necessary changes for location updates following the link.Using NSLocationAlwaysUsageDescription in my Info.plist.

1

There are 1 best solutions below

2
On BEST ANSWER

Assuming that you asked the user for location permission (you have NSLocationAlwaysUsageDescription or NSLocationWhenInUseDescription keys in your info.plist) then didUpdateLocations is:

  • Always called when the app is in foreground mode
  • NOT called when the application is in background unless you enabled the background location mode.