startMonitoringSignificantLocationChanges 未触发?

发布于 2024-12-10 18:21:33 字数 592 浏览 0 评论 0原文

我正在测试一个在装有 IOS 4.01 的 3GS 上使用 startMonitoringSignificantLocationChanges 的应用程序(我希望我的应用程序能够在任何版本的 IOS4 中工作,因此我没有升级该设备上的操作系统)。

info.pllist 有一个“注册位置更新”背景键(startMonitoringSignificantLocationChanges 不需要,但应用程序中的其他地方需要)。

我发现,如果设备处于睡眠模式并且我的应用程序在后台运行,即使我长途旅行(经过相当多的手机信号塔)和很长时间,也不会触发重要的位置更新。但是,一旦我按 Home 键唤醒设备(我的应用程序仍在后台,前台没有任何内容) - 我的应用程序中的位置事件处理程序就会被该区域的有效位置触发(我可以验证通过检查精度远超过 1000 米,这是一次重要的定位事件)。

这违背了监控重大位置变化的整体理念,因为用户在旅行时不会带着处于活动状态的设备。

不幸的是,我没有具有更高级操作系统的设备来检查这一点(我的所有其他设备都不是 iPhone,并且它们不支持 startMonitoringSignificantLocationChanges)。

这是一个已知问题还是我做错了什么?

I'm testing an app that uses startMonitoringSignificantLocationChanges on a 3GS with IOS 4.01 (I want my app to work in any version of IOS4 so I haven't upgraded the OS on this device).

info.pllist has a "registered for location updates" background key (not needed for startMonitoringSignificantLocationChanges but needed elsewhere in the app).

I found out that if the device is in sleep mode and my app is in the background, significant location updates are not triggered even if I travel for a long distance (passing through quite a few cell towers) and a long time. But as soon as I press the Home key to wake up the device (with my app still in the background, nothing in the foreground) - the location event handler in my app gets triggered with a valid location for that area (I can verify that this is a significant location event by checking the accuracy which is well over 1000 meters).

This defies the whole idea of monitoring significant location changes, because users do not travel with their devices in active state.

Unfortunately I don't have a device with a more advanced OS to check this (all my other devices are not iPhones and they do not support startMonitoringSignificantLocationChanges).

Is this a know issue or am I doing something wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独留℉清风醉 2024-12-17 18:21:33

您需要确保您的 AppDelegate 设置为 CLLocationManagerDelegate,并设置正确的方法以在发生重大更改时接收回调。如果您将不同的类设置为代表,并且您的应用程序进入后台...很可能该类不会被唤醒来接收它们。

尝试设置您的 AppDelegate 来接收它们...然后向您的班级发出您需要完成的任何工作。

You need to make sure your AppDelegate is set up as the CLLocationManagerDelegate and have the correct methods set to receive the callbacks when the significant change is fired. If you have a different class set up as the delegate and your app goes to the background... chances are that class won't get woke up to receive them.

Try setting your AppDelegate to receive them... then call out to your class for any work you need done.

过气美图社 2024-12-17 18:21:33

您是否仔细查看过这个问题及其类似主题的答案?

如果没有看到你的代码,很难判断,但也许你的后台行为的实现中缺少一些东西?

Have you looked through this question and its answers on a similar topic?

It's hard to tell without seeing your code, but maybe there's something missing in your implementation of the background behavior?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文