[英]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.
重大更改的位置更新至少每15分钟唤醒一次系统和您的应用程序,即使没有发生位置更改也是如此。
But it doesn't work as described... 但是它不能像描述的那样工作...
In my Xamarin.iOS project I use 在我的Xamarin.iOS项目中
_locationManager = new CLLocationManager
{
PausesLocationUpdatesAutomatically = false,
};
_locationManager.StartMonitoringSignificantLocationChanges();
*I've skipped all permissions checks here and plist config. *我已跳过此处和plist配置的所有权限检查。 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.
更新工作正常,应用程序会收到更新,但仅在实际移动的情况下,而不是每15分钟更新一次:如果不移动设备,则可能需要几个小时。
I've also saw this question and answer with NSTimer , but I need these updates even when the app is terminated or backgrounded. 我也看到了NSTimer的问答 ,但即使应用终止或后台运行,我也需要这些更新。
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). 根据苹果工作人员在苹果开发者论坛上对该线程 的答复 ,文档与您,该线程的原始海报以及我本人正在观察的内容之间可能存在差异(即与所记录的内容相反) ,可能每15分钟没有更新)。
Note the phrasing in the documentation: “every 15 minutes, at minimum”. 请注意文档中的措辞:“至少每15分钟”。 We all seem to have interpreted that “minimum” as the minimum frequency (ie once per 15 minutes, or twice per 15 minutes, or more).
我们所有人似乎都将“最小”解释为最小频率(即每15分钟一次,或每15分钟两次,或更多)。 But it could also be read as the minimum time interval (ie every 15 minutes, or every 30 minutes or more).
但是也可以将其读取为最小时间间隔(即每15分钟,或者每30分钟或更长时间)。 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: 重要的是Apple员工在回复中指出的内容:
[…] simply using [significant location change] does not guarantee that your app will be resumed as [sic] some periodic rate.
[...]简单地使用[显著位置变化]并不能保证你的应用程序将恢复为[原文]一些周期性的速度。
PS. PS。 For those who can do something about the documentation: rdar://30345408 (not mine)
对于那些可以对文档做些事情的人:rdar:// 30345408(不是我的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.