gpt4 book ai didi

ios - didUpdateLocations 总是用不同的坐标多次调用

转载 作者:行者123 更新时间:2023-11-29 02:46:37 50 4
gpt4 key购买 nike

因此,我的应用需要每隔 15 米捕获一次位置。

在viewDidLoad中

NSOperationQueue.mainQueue().addOperationWithBlock {
self.manager = CLLocationManager()
self.manager.delegate = self
self.manager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
self.manager.distanceFilter = 15.0
self.manager.headingFilter = 10
self.manager.startUpdatingLocation()
}

第一次(我不动),在

func locationManager(manager:CLLocationManager, didUpdateLocations locations:[AnyObject])

我得到(真实的例子):*.1488241293991*.5997807433053

第二次:*.1489010891664*.599624152471

我在真实设备上使用 ios7 和 swift 进行测试。

我做错了什么?

谢谢!

最佳答案

来自 CLLocationManager 类引用:

When requesting high-accuracy location data, the initial event delivered by the location service may not have the accuracy you requested. The location service delivers the initial event as quickly as possible. It then continues to determine the location with the accuracy you requested and delivers additional events, as necessary, when that data is available.

因此您检索到的第一个位置可能不准确。

关于ios - didUpdateLocations 总是用不同的坐标多次调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25032602/

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