Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deferredLocationUpdatesAvailable returns NO in iOS 10

I am trying to use some CoreLocation features, and I am running into problems with deferred location updates.

For some reason when the app was updated for iOS 10 deferredLocationUpdatesAvailable returns NO always. I am testing on an iPhone 6s, so I know that the device is capable of using GPS features.

I tried using this to debug:

[CLLocationManager deferredLocationUpdatesAvailable]

I can't figure out if this is an issue with iOS 10 or if I have something set incorrectly.

In this method:

- (void)locationManager:(CLLocationManager *)manager didFinishDeferredUpdatesWithError:(NSError *)error {
    self.deferringUpdates = NO;
    NSLog(@"DEFERRING Error: [%@]", error);
    if (error) {
        [[LocationManagerClient alertWithMessage:error.localizedDescription andTitle:error.domain] show];
    }
}

I end up logging this error:

DEFERRING Error: [Error Domain=kCLErrorDomain Code=11 "(null)"]

Has anyone else run into this problem with iOS 10 or have any idea what is going on?

Edit: This is how I am setting the distance filter

- (void)configureForApplicationWillResignActive {
    [_locationManager setAllowsBackgroundLocationUpdates:YES];
    [_locationManager setPausesLocationUpdatesAutomatically:NO];
    [_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [_locationManager setDistanceFilter:kCLDistanceFilterNone];   // use distance filter
    [_locationManager requestAlwaysAuthorization];
}

- (void)configureForApplicationDidBecomeActive {
    [_locationManager setAllowsBackgroundLocationUpdates:YES];
    [_locationManager setPausesLocationUpdatesAutomatically:NO];
    [_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [_locationManager setDistanceFilter:kCLDistanceFilterNone];   // use distance filter
    [_locationManager requestAlwaysAuthorization];
}
like image 437
Erik Avatar asked Sep 14 '16 20:09

Erik


3 Answers

I have already filed a Radar (28303779) with proof of concept sample code - also contains the wording from the radar. I have also opened a dev forum post and it appears a lot of engineers are facing the same problem. deferredLocationUpdatesAvailable() is also returning false in iOS 10. Seems like apple has intentionally turned off the functionality.

Update

My Bug Report got closed saying 'it works as intended'. I suppose Apple does not intend to fix it and it was mistakenly taken out without deprecation first.

like image 92
zakishaheen Avatar answered Oct 19 '22 17:10

zakishaheen


Deferred updates are now officially deprecated (in iOS 13). This is effectively an admission that they have not been supported for several years.

like image 31
matt Avatar answered Oct 19 '22 16:10

matt


I looks like this is a bug in iOS 10

We should all file radars to get it fixed, please dupe mine: openradar.appspot.com/radar?id=4927958787555328

like image 29
Thomas Einwaller Avatar answered Oct 19 '22 17:10

Thomas Einwaller