CMPedometer StepCounting not Available

女生的网名这么多〃 提交于 2020-01-02 04:44:15

问题


My code is:

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!"];
    }

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

Step counting is not available on this device!

How can i make it available for step counting ?


回答1:


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.

You need at least an iPhone 5s




回答2:


The iPhone 4s, 5 and 5c do not have the M7 Motion Sensor co-processor so they will not record steps. The iPhone 5s, 6 and 6 Plus all have a motion co-processor.



来源:https://stackoverflow.com/questions/27479118/cmpedometer-stepcounting-not-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!