iPhone 开发:CoreLocation 和 MapKit

发布于 2024-08-24 13:35:56 字数 246 浏览 4 评论 0原文

当 MapView.showUserLocation 也为 TRUE 时,使用位置管理器检索位置信息有多糟糕?

我有一种情况,我想显示蓝点来指示用户的当前位置,并且我想在一段时间间隔后记录用户的当前位置。话虽如此,在某些情况下可能会显示用户的当前位置,但我仍然想获取用户的当前位置。

我想我必须在控制器类中使用位置管理器,但是设置 showUserLocation = YES 意味着我会消耗更多电池,因为两个位置管理器同时工作?这个假设正确吗?

How bad is it to use Location Manager to retrieve the location information when MapView.showUserLocation is also TRUE?

I have a situation where i want to show the blue dot to indicate the user's current location, and i want to record the user's current location after some time interval. Having said that, there may be situations where the user's current location is now being shown, but i still want to get the user's current location.

I think i'll have to use the Location Manager in my controller class, but setting showUserLocation = YES would mean that i'll be draining more battery since two Location Managers are working at the same time? Is this assumption correct?

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

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

发布评论

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

评论(2

嗳卜坏 2024-08-31 13:35:56

正如其他社区中所讨论的,您可以设置 mapView.showUserLocation = YES 并仍然使用 CLLocationManager 来检索最新的位置信息。

一般来说,同时运行多个 CLLocationManager 实例不会产生冲突。

As discussed on other communities, you can have mapView.showUserLocation = YES and still use CLLocationManager to retrieve the most current location information.

In general there's no conflict involved with having multiple CLLocationManager instances running at the same time.

双马尾 2024-08-31 13:35:56

只需将坐标保存在数组中并为过去记录的位置绘制地图注释即可。您不需要运行多个位置管理器。

Just save the coordinates in an array and draw mapannotations for past recorded locations. You dont need to run multiple location managers.

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