CLLocationManager 确保 iPhone 的最佳准确性

发布于 2024-08-01 16:08:45 字数 128 浏览 8 评论 0原文

有人对如何在位置管理器上获得最佳水平精度有任何建议吗? 我已将所需的精度设置为 NearestTenMeters,但考虑到精度始终会根据覆盖区域而变化,如何在 locationManager 中编写一些代码以仅在获得最佳水平精度后停止更新?

Does anyone have any suggestions on how to obtain the best horizontal accuracy on the location manager? I have set the desired accuracy to NearestTenMeters, but given that the accuracy can always change depending on coverage area, how can I write some code in the locationManager to stop updating only after I get the best horizontal accuracy?

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

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

发布评论

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

评论(2

风吹过旳痕迹 2024-08-08 16:08:45

如果您希望它达到一定的精度,请将委托方法设置

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

为具有

if(newLocation.horizontalAccuracy <= (some number) )
    [locationManager stopUpdatingLocation];

类似的值。

If you want it to be to a certain accuracy, set the delegate method

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

to have

if(newLocation.horizontalAccuracy <= (some number) )
    [locationManager stopUpdatingLocation];

something like that.

清旖 2024-08-08 16:08:45

通常,硬件开启的时间越长,获得的位置越多,获得的准确度就越高。 您可以尝试尽早打开管理器,让它变得准确,然后抓取位置。 当目标移动时,它也有帮助,当 GPS 移动时,芯片能够获得更准确的读数。 此外,设备的位置也会有所不同,如果您在野外,您将获得比在沙坑中更好的读数,因此有时您获得的读数是可用的最佳读数。 您的代码可以等待一段时间,直到它不再从位置管理器获得更新,然后它可能处于最佳准确性。

Typically the longer the hardware is on and the more locations it gets the more accurate it gets. You can try turning on the manager early to let it get accurate and then grab the location. It also helps when the target is moving, the chip is able to get more accurate readings when gps is moving. Also the location of the device makes a diffrence, you will get much better reads if you are outside on a field than if you are in a bunker, so sometimes the read you get is the best thats available. Your code can wait till it gets no more updates from location manager for some time, then its probably at its best accuracy.

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