gpt4 book ai didi

iphone - 罗盘校准物镜-c

转载 作者:技术小花猫 更新时间:2023-10-29 10:56:51 26 4
gpt4 key购买 nike

我尝试在我的 iOS 应用程序中使用指南针。我有一个问题。如果我实现locationManagerShouldDisplayHeadingCalibration 方法并在其中返回YES,然后校准显示始终显示。但我应该让它像苹果 map 一样。 IE。有时应该显示校准显示。什么时候应该校准罗盘。

最佳答案

好吧,我无法发表评论,所以我想我应该发表回复,因为 Claude Houle 的回复对我很有用。

我正在使用 Claude Houle 的 response 的改进版本.

- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager{
if(!manager.heading) return YES; // Got nothing, We can assume we got to calibrate.
else if(manager.heading.headingAccuracy < 0 ) return YES; // 0 means invalid heading, need to calibrate
else if(manager.heading.headingAccuracy > 5 ) return YES; // 5 degrees is a small value correct for my needs, too.
else return NO; // All is good. Compass is precise enough.
}

还想说说 Claude Houle 所说的几乎实现了 API 文档 here其中指出:

If you return NO from this method or do not provide an implementation for it in your delegate, Core Location does not display the heading calibration alert. Even if the alert is not displayed, calibration can still occur naturally when any interfering magnetic fields move away from the device. However, if the device is unable to calibrate itself for any reason, the value in the headingAccuracy property of any subsequent events will reflect the uncalibrated readings.

关于iphone - 罗盘校准物镜-c,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17089155/

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