didUpdateLocations is working fine when app is active and running in foreground, but it stops to work as soon as app enters into background
In .h file
@property (nonatomic, strong) CLLocationManager *customerLocationManager;
in .m file
@synthesize customerLocationManager;
customerLocationManager = [[CLLocationManager alloc] init];
customerLocationManager.delegate = self;
customerLocationManager.desiredAccuracy = kCLLocationAccuracyBest;
customerLocationManager.distanceFilter = kCLDistanceFilterNone;
if(IS_OS_8_OR_LATER) {
[customerLocationManager requestAlwaysAuthorization];
}
[customerLocationManager startUpdatingLocation];
I have integrated NSLocationAlwaysUsageDescription in info.plist. Background modes have been enabled and Location Updates option has been selected
I have integrated NSLocationAlwaysUsageDescription in info.plist. Background modes have been enabled and Location Updates option has been selected
Good, but in iOS 9 there's a further requirement: you have to set the location manager's allowsBackgroundLocationUpdates
to YES. You are not doing that, so you're not going to get background location updates.
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