Hi, recently with the seed version of iOS 9 GM, I saw a location update (allowDeferredLocationUpdatesUntilTraveled: timeout :) does not get a delay. I get an error kCLErrorDeferredFailed - the location manager did not arrive in deferred mode for an unknown reason.
Due to this error, it does not enter deferral mode at all, and location updates are continuously triggered. The same code is used to work in iOS 8.4 and lower versions. It discharges the battery of my device by a huge percentage. Is there something we need to explicitly point out or mention for iOS 9. Didn't find anything from the Apple documentation?
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { if (!self.deferringUpdates) { [self.locationManager allowDeferredLocationUpdatesUntilTraveled:CLLocationDistanceMax timeout:30]; self.deferringUpdates = YES; } } -(void)locationManager:(CLLocationManager *)manager didFinishDeferredUpdatesWithError:(NSError *)error {
I also set the allowBackgroundLocationUpdates property, but even this did not help.
self.locationManager.allowsBackgroundLocationUpdates=YES;
In iOS 9 and later, regardless of the purpose of the deployment, you must also set the allowBackgroundLocationUpdates property of the location object to YES to receive background location updates. By default, this property is NO, and it should remain that way until your application actively requests a background update.
Reduce placement accuracy and duration
Please let me know what else I need to do.
thanks
Sree source share