gpt4 book ai didi

ios - CMPedometer 计步器不可用

转载 作者:可可西里 更新时间:2023-11-01 04:25:06 24 4
gpt4 key购买 nike

我的代码是:

if ([CMPedometer isStepCountingAvailable]) {

self.pedometer = [[CMPedometer alloc] init];
}
else {
NSLog(@"Step counting is not available on this device!");
[SVProgressHUD showErrorWithStatus:@"Step counting is not available on this device!"];
}

当我在 iOS8 及更高版本的设备上运行它时,它说:

Step counting is not available on this device!

如何让它可用于计步?

最佳答案

您的代码是正确的,它产生了预期的结果。 iPhone 5 没有跟踪步数的硬件(Apple M7 芯片),因此无法计算步数。

你至少需要一部 iPhone 5s

关于ios - CMPedometer 计步器不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27479118/

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