我的代码是:
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和更高版本的设备上运行它时,它说:
在该设备上无法进行步数计数!
我如何使它可用于步数计数?
您的代码是正确的,并且会产生预期的结果。iPhone 5没有用于跟踪步骤的硬件(Apple M7芯片),因此步骤计数不可用。
您至少需要一部iPhone 5s
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句