ios - DesiredAcuracy和DistanceFilter在CoreLocation中的作用是什么,ios

标签 ios iphone gps core-location

当用户从 iOS 项目中的 CoreLocation 步行时,我正在选取用户的 GPS 坐标,我想选取每 1 米或每 10 秒的纬度和经度,

我可以使用 DesiredAcuracy 和 DistanceFilter 来执行此操作吗?

如果不是,这两个(DesiredAcuracy 和 DistanceFilter)实际上会做什么?

或者我应该创建自己的计时器来完成它吗?

最佳答案

我可以使用 DesiredAcuracy 和 DistanceFilter 这样做吗? 是的,根据 docs :

期望准确度

The receiver does its best to achieve the requested accuracy; however, the actual accuracy is not guaranteed.

You should assign a value to this property that is appropriate for your usage scenario. For example, if you need the current location only within a kilometer, you should specify kCLLocationAccuracyKilometer and not kCLLocationAccuracyBestForNavigation. Determining a location with greater accuracy requires more time and more power.

在你的情况下,你应该使用 kCLLocationAccuracyKilometer 用于未插入的设备(例如,用户使用它来运行距离)或 kCLLocationAccuracyBestForNavigation 用于插入的设备(例如,在车里)

kCLLocationAccuracyBestForNavigation

Use the highest possible accuracy and combine it with additional sensor data. This level of accuracy is intended for use in navigation applications that require precise position information at all times and are intended to be used only while the device is plugged in.

kCLLocationAccuracyKilometer

Accurate to the nearest kilometer. Available in iOS 2.0 and later.

kCLLocationAccuracyBest

Use the highest-level of accuracy. Available in iOS 2.0 and later.

距离过滤器

This distance is measured relative to the previously delivered location. >Use the value kCLDistanceFilterNone to be notified of all movements. The default value of this property is kCLDistanceFilterNone.

因此,如果您需要频繁的距离更新(即用户必须移动多远才能收到更新),您应该使用kCLDistanceFilterNone

关于ios - DesiredAcuracy和DistanceFilter在CoreLocation中的作用是什么,ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31476113/

相关文章:

ios - 当单元格高度减小到零时,表格单元格中的日期选择器会压缩

ios - 搜索字典数组的简便方法

android - 在 root 设备上打开 GPS

ios - Swift 3.0 静态实例,迁移工具的语法变化

android - 在 Woocommerce Rest API 调用中按多个属性及其属性术语过滤产品列表

ios - 如何从ios中的文档目录复制不同类型的文件

android - 为什么在使用 LocationManager 时打开 Wifi 但未连接有助于网络定位?

gps - 路线查找软件如何工作?

ios - wifi 关闭时邮件未发送且未显示错误

iphone - BOOL 本身在 ViewController 之间从 YES 变为 NO?