iOS CLLocationManager - 确定位置后如何调用方法
我正在使用 CLLocation 管理器来获取我的纬度和纬度。很长,而且似乎效果很好。然而,无论怎样,第一个读数的精度始终是 10。从这里开始,它似乎从大约 1500m 处开始正确引导。这是一个问题的原因是,为了确定该方法是否被调用,我正在检查准确度是否低于 15(这是错误的读数),因此会在错误的时间调用该方法。我该如何解决这个问题?
I am using CLLocation manager to get my lat & long, and it seems to work rather well. However, the first reading of accuracy no matter what, is always 10. From here it seems to home-in correctly starting at about 1500m. The reason that this is a problem is because to determine whether the method is called, I am checking if the accuracy is below 15, which this false reading is, and therefore calling the method at the wrong time. How do I get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CoreLocation 可能会缓存一些旧的位置值以“加速”首次位置更新。您可以通过检查 CLLocation 的
timeStamp
属性来查看您的位置是否是新位置。CoreLocation may cache some old location values to "speed up" first location update. You can see if your location is a new one by checking CLLocation's
timeStamp
property.您可以使用水平精度进行检查,stackoverflow 中有很多关于 cllocationmanager 的帖子。要调用方法,您可以使用 NSNotificationCenter,Deleagate &当然还有协议机制和IBAction。这取决于您的要求。
you can check using horizontal accuracy there are many posts in stackoverflow regarding cllocationmanager. And for calling a method you can use NSNotificationCenter,Deleagate & protocol mechanism and IBAction of course. It depends on your requirement.