0

CMPedometer queryPedometerData() method seems to be return wrong steps count. But I am not sure with all device. I think the reason from M7 motion coprocessor pedometer, ins't it?

Please check the log bellow:

2019-03-28T22:16:43Z | ViewController | line: 147 | Steps 00117  | startDate 2019-03-28 01:00:00 +0000 | endDate 2019-03-28 02:00:00 +0000
2019-03-28T22:16:43Z | ViewController | line: 147 | Steps 00000  | startDate 2019-03-28 05:00:00 +0000 | endDate 2019-03-28 06:00:00 +0000

Adding 10 seconds

2019-03-28T22:18:39Z | ViewController | line: 147 | Steps 00000  | startDate 2019-03-28 01:00:00 +0000 | endDate 2019-03-28 02:00:10 +0000
2019-03-28T22:18:39Z | ViewController | line: 147 | Steps 00870  | startDate 2019-03-28 05:00:00 +0000 | endDate 2019-03-28 06:00:10 +0000

And adding 12 seconds

2019-03-28T22:18:08Z | ViewController | line: 147 | Steps 00117  | startDate 2019-03-28 01:00:00 +0000 | endDate 2019-03-28 02:00:12 +0000
2019-03-28T22:18:08Z | ViewController | line: 147 | Steps 00870  | startDate 2019-03-28 05:00:00 +0000 | endDate 2019-03-28 06:00:12 +0000

My query:

pedometer.queryPedometerData(from: start, to: end) { (pedometerData, error) in
    if let error = error {
        print("error \(error.localizedDescription)")
    }
    guard let data = pedometerData else { return }

    allPedometerData.append(data)
    logger("Steps \(String(format: "%05d", data.numberOfSteps.intValue))  | startDate \(data.startDate) | endDate \(data.endDate)")

}

Something like that: CMPedometer queryPedometerData() returning 0 steps when steps exist

Bhaumik
  • 1,218
  • 1
  • 11
  • 20
  • 1
    I have seen this issue popping up on my health insurance fitness app. When I asked them about it they indicated that Apple has acknowledged a bug in core motion that occasionally results in dropped minute level step data (zero steps when steps certainly exist). This can be seen in different counts from the HealthKit data. I have not yet found anything about this from apple. – Paul Gibson Apr 02 '19 at 16:54
  • For me, sometimes the number of steps goes to very big number. Do you have any any copy of their official acknowledgement about the bug? And what measure do we do to avoid such problem? One measure could be to check if 'error' variable is not nil. – Chanchal Raj Mar 13 '20 at 09:58

0 Answers0