gpt4 book ai didi

objective-c - distanceFilter 属性使用

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:25:16 25 4
gpt4 key购买 nike

CLLocationManager 类文档中,我找到了对 distanceFilter 属性的解释:

This property is used only in conjunction with the standard location services and is not used when monitoring significant location changes.

你能解释一下吗?

最佳答案

CLLocationManager 中,distanceFilter 用于在设备移动 x 米时通知更改。默认值为 kCLDistanceFilterNone: 报告所有移动。

来自docs

After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected. For example, it might generate a new event when the device becomes associated with a different cell tower. It does not rely on the value in the distanceFilter property to generate events.

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.

这就是为什么 distanceFilter 仅与标准定位服务一起使用,而不在监视重大位置变化时使用,例如。 desiredAccuracyheading 信息。

这是因为通常知道一个人移动了 x 米并没有多大用处。然而,知道一个人在 y 方向上以 z 精度移动了 x 米是非常有值(value)的。

关于objective-c - distanceFilter 属性使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10974629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com