CMPedometer queryPedometerData()返回错误的步数

时间:2019-03-28 15:37:56

标签: ios swift core-motion

CMPedometer queryPedometerData()方法似乎返回错误的步数。但是我不确定所有设备。我认为是M7 motion coprocessor pedometer的原因,不是吗?

请检查以下日志:

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

增加10秒

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

加上12秒

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

我的查询:

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)")

}

类似的东西:CMPedometer queryPedometerData() returning 0 steps when steps exist

0 个答案:

没有答案