startUpdatingMyLocation是否强制调用iphone sdk中位置管理器的didUpdateToLocation方法

发布于 2024-12-27 20:30:50 字数 125 浏览 1 评论 0原文

我需要澄清一下。 startUpdatingMyLocation 方法必须调用 didUpdateToLocation 吗?更新位置时不是会自动调用 didUpdateToLocation 方法吗?

请伙计澄清我的澄清。

I need a clarification that. Is startUpdatingMyLocation method mandatory to call didUpdateToLocation? isn't the didUpdateToLocation method automatically called when the location is updated?

Guy's please clear my clarification.

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

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

发布评论

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

评论(2

信愁 2025-01-03 20:30:50

文件指出

通过调用startUpdatingLocation启动标准位置服务
方法。此服务最适合需要的应用程序
对位置事件的传递进行更细粒度的控制。
具体来说,它考虑了desiredAccuracy中的值
和 distanceFilter 属性来确定何时传递新事件。
标准定位服务的精度需要
导航应用或任何需要高精度的应用
需要位置数据或定期更新流。然而,
这些服务通常需要位置跟踪硬件
启用更长时间,这可能会导致更高的功率
用法。

对于不需要定期位置事件流的应用程序,
考虑使用 startMonitoringSignificantLocationChanges 方法
相反,开始传递事件。这个方法比较合适
对于大多数只需要初始用户的应用程序
位置修复并且仅当用户移动显着位置时才需要更新
距离。该接口仅在检测到时才传递新事件
更改设备的相关蜂窝塔,从而减少
频繁更新并显着降低功耗。

无论您使用哪种定位服务,位置数据都是
通过位置管理器的关联报告给您的应用程序
委托对象。因为可能需要几秒钟的时间才能返回
初始位置,位置管理器通常会提供
之前立即缓存位置数据,然后提供更多
最新的位置数据可用。因此它是
检查任何位置对象的时间戳总是一个好主意
在采取任何行动之前。如果两个定位服务均已启用
同时,他们使用同一组委托传递事件
方法。

因此,您可以使用两者中的任何一个(startUpdatingLocationstartMonitoringSignificantLocationChanges)来获取位置更新,但您必须为正在调用的委托方法调用其中任何一个。 (恕我直言)

The documents state

Start standard location services by calling the startUpdatingLocation
method. This service is most appropriate for applications that need
more fine-grained control over the delivery of location events.
Specifically, it takes into account the values in the desiredAccuracy
and distanceFilter property to determine when to deliver new events.
The precision of the standard location services are needed by
navigation applications or any application where high-precision
location data or a regular stream of updates is required. However,
these services typically require the location-tracking hardware to be
enabled for longer periods of time, which can result in higher power
usage.

For applications that do not need a regular stream of location events,
consider using the startMonitoringSignificantLocationChanges method to
start the delivery of events instead. This method is more appropriate
for the majority of applications that just need an initial user
location fix and need updates only when the user moves a significant
distance. This interface delivers new events only when it detects
changes to the device’s associated cell towers, resulting in less
frequent updates and significantly lower power usage.

Regardless of which location service you use, location data is
reported to your application via the location manager’s associated
delegate object. Because it can take several seconds to return an
initial location, the location manager typically delivers the
previously cached location data immediately and then delivers more
up-to-date location data as it becomes available. Therefore it is
always a good idea to check the timestamp of any location object
before taking any actions. If both location services are enabled
simultaneously, they deliver events using the same set of delegate
methods.

So you can use any of the two , either startUpdatingLocation or startMonitoringSignificantLocationChanges to get the location updates but you will have to call any one of these for the delegate method being called. (IMHO)

半仙 2025-01-03 20:30:50

通过调用 startUpdatingLocation 方法启动标准位置服务。此服务最适合需要对位置事件的传递进行更细粒度控制的应用程序。具体来说,它会考虑desiredAccuracy 和distanceFilter 属性中的值来确定何时传递新事件。导航应用程序或任何需要高精度位置数据或定期更新流的应用程序都需要标准位置服务的精度。然而,这些服务通常需要启用位置跟踪硬件较长时间,这可能会导致更高的功耗。

对于不需要常规位置事件流的应用程序,请考虑使用 startMonitoringSignificantLocationChanges 方法来启动事件传递。此方法更适合大多数只需要初始用户位置修复并且仅当用户移动很远距离时才需要更新的应用程序。仅当该接口检测到设备关联的蜂窝塔发生更改时,它才会传送新事件,从而减少更新频率并显着降低功耗。

无论您使用哪种位置服务,位置数据都会通过位置管理器的关联委托对象报告给您的应用程序。由于返回初始位置可能需要几秒钟的时间,因此位置管理器通常会立即传送先前缓存的位置数据,然后在可用时传送更多的最新位置数据。因此,在采取任何操作之前检查任何位置对象的时间戳始终是一个好主意。如果同时启用两个位置服务,它们将使用同一组委托方法传递事件。

Start standard location services by calling the startUpdatingLocation method. This service is most appropriate for applications that need more fine-grained control over the delivery of location events. Specifically, it takes into account the values in the desiredAccuracy and distanceFilter property to determine when to deliver new events. The precision of the standard location services are needed by navigation applications or any application where high-precision location data or a regular stream of updates is required. However, these services typically require the location-tracking hardware to be enabled for longer periods of time, which can result in higher power usage.

For applications that do not need a regular stream of location events, consider using the startMonitoringSignificantLocationChanges method to start the delivery of events instead. This method is more appropriate for the majority of applications that just need an initial user location fix and need updates only when the user moves a significant distance. This interface delivers new events only when it detects changes to the device’s associated cell towers, resulting in less frequent updates and significantly lower power usage.

Regardless of which location service you use, location data is reported to your application via the location manager’s associated delegate object. Because it can take several seconds to return an initial location, the location manager typically delivers the previously cached location data immediately and then delivers more up-to-date location data as it becomes available. Therefore it is always a good idea to check the timestamp of any location object before taking any actions. If both location services are enabled simultaneously, they deliver events using the same set of delegate methods.

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