CMPedometer StepCounting不可用 [英] CMPedometer StepCounting not Available

查看:302
本文介绍了CMPedometer StepCounting不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是:

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及更高版本的设备上运行时,它说:

When i run it on iOS8 and later devices, it says:


此设备无法提供步数!

Step counting is not available on this device!

如何使其可用于计步?

推荐答案

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

Your code is correct and it yields the expected result. The iPhone 5 does not have the hardware (the Apple M7 chip) to track steps, so step counting is not available.

你至少需要iPhone 5s

You need at least an iPhone 5s

这篇关于CMPedometer StepCounting不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆