I'm trying to track location using locationManager
in the background every "time interval" when the app is in the background.
Its working great on iOS 8 iPhone 6 - but i keep getting terminated after 2.5 - 3 minutes, by the iOS in iOS 9 iPhone 6s.
My main question is - what can be the difference between iPhone 6 iOS 8 and 6s iOS 9? better watchdog timer for background tasks? if so how can i workaround that?
I sow solutions that includes decrease of accuracy to save battery life instead of time intervals, I don't want that because the user is seeing the location monitoring indication all the time(full arrow).
some of my code -
-(void)initialize
{
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
self.locationManager.distanceFilter = 5;
self.locationManager.delegate = self;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(addMonitorsBeforeWillTerminate)
name:UIApplicationWillTerminateNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
[[UIApplication sharedApplication]beginBackgroundTaskWithExpirationHandler:nil];
}];
[self.locationManager startUpdatingLocation];
}
thanks
For however struggling with that in the future, the answer came from "technerd" by comment so i turned it in to an answer -