IOS 9 update Deferred location not working

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 { // Stop deferring updates self.deferringUpdates = NO; } 

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

+5
source share
1 answer

Read the discussion on the API links page.

A few things to try, as mentioned here

  • Kill all applications from the multitasking panel
  • Make sure no other apps are using location services.
  • Disconnect the device from the debugger and MacBook (make sure it still receives the call by logging didUpdateLocations to a file)
  • Verify that the device supports pending updates.
  • Make sure distanceFilter is None, the desired property is better
0
source

All Articles