简体   繁体   中英

iOS Significant-Change Location event doesn't update the app every 15 mins

According to the documentation :

Significant-change location updates wake the system and your app once every 15 minutes, at minimum, even if no location changes have occurred.

But it doesn't work as described...

In my Xamarin.iOS project I use

_locationManager = new CLLocationManager
{
    PausesLocationUpdatesAutomatically = false,
};
_locationManager.StartMonitoringSignificantLocationChanges();

*I've skipped all permissions checks here and plist config. Updates work fine, the app receives updates, but only in case of real movement, not every 15 mins: it can take hours if a device is not moved.

I've also saw this question and answer with NSTimer , but I need these updates even when the app is terminated or backgrounded.

According to a reply by an Apple staff member to this thread on the Apple developer forums , there may be a discrepancy between the documentation and what you, the original poster on that thread, and I myself are observing (ie that in contrast to what's documented, there may not be updates every 15 minutes).

Note the phrasing in the documentation: “every 15 minutes, at minimum”. We all seem to have interpreted that “minimum” as the minimum frequency (ie once per 15 minutes, or twice per 15 minutes, or more). But it could also be read as the minimum time interval (ie every 15 minutes, or every 30 minutes or more). It doesn't give a guarantee of how frequent, but rather sets an expectation of how infrequent the updates will be. The documentation isn't wrong, but certainly open to multiple interpretations.

What's important is what the Apple staff member states in their reply:

[…] simply using [significant location change] does not guarantee that your app will be resumed as [sic] some periodic rate.

PS. For those who can do something about the documentation: rdar://30345408 (not mine)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM