CLLocationManager更新频率 [英] CLLocationManager Update frequency

查看:185
本文介绍了CLLocationManager更新频率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经按照以下方式配置了locationManager。

I have configured locationManager as follows.

_locationManager = [[CLLocationManager alloc] init];
[_locationManager setDelegate:self];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters];
[_locationManager setDistanceFilter:kCLDistanceFilterNone];

应用程序运行时,我从委托方法中获得了一些更新。
当我不更改位置并且移动电话静止不动约2小时时,在前10分钟内我会收到大约10-12个更新,然后停止接收更新。

When the application runs, I get some updates from the delegate methods. And when I do not change the location, and the mobile is stationary for about 2 hrs, I receive about 10-12 updates in the first 10 mins, and then stop receiving updates.

我了解的是 desiredAccuracy 是设备将继续尝试越来越多的准确方法来获取当前位置的时间。因此,在我的情况下,大约需要10分钟才能获得所需的精度。

What I understand is that desiredAccuracy is how long the device will keep trying more and more accurate methods to get the current location. So in my case, it takes about 10 mins to get the desired accuracy.

我想确认是否正确。还有一种方法可以使我即使设备不动也能定期获取位置更新?

I want to confirm if this is true. Also is there a way where I can get regular location updates even if the device is not moving?

推荐答案

为什么会期望要更新的位置(如果未更改)?

Why would you expect the location to be updated if it hasn't changed?

如果要定期刷新结果,请使用自己创建的 NSTimer

If you want to periodically refresh your results, use an NSTimer you've created yourself.

当设备到达误差幅度< requiredAccuracy,它将不再要求更准确的结果。如果设备移动了,它将开始再次询问,直到再次使位置达到所需的精度为止。

When the device gets a location with a margin of error < desiredAccuracy, it will stop asking for more accurate results. If the device moves then it will start asking again, until it once again gets the location to the desired accuracy.

如果您指定10m作为精度,则说明几乎可以肯定,这将完全依赖GPS-信号塔和wifi并不那么精确(通常)。

If you're specifying 10m for the accuracy then you're almost certainly going to be relying on GPS - cell towers and wifi aren't that accurate (usually).

要确定设备是否移动,它会使用距离过滤器-将此值设置为none意味着您一直要求它精确到最近的10m-这可能会耗尽电池电量;)

To determine if the device has moved, it uses distance filter - by setting this to none you are asking it to be accurate to the nearest 10m all the time - this is probably going to be quite draining on the battery ;)

这篇关于CLLocationManager更新频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆