'What does Core Motion CMErrorDomain error code 107 mean?

When I use CMPedometer pedometer I get the error:

Error Code=107 Domain=CMErrorDomain "(null)"
Error Domain=CMErrorDomain Code=107 "(null)"

What does this error mean?

- (IBAction) startRun:(id)sender
    if(![CMPedometer isStepCountingAvailable]) {
        return
    }
    
    [self.pedometer startPedometerUpdatesFromDate: [NSDate dateWithTimeIntervalSinceNow: 2] withHandler:^(CMPedometerData *_Nullable pedometerData, NSError* _Nullable error) {
        if(error ){
            NSLog(@"%@", error) ;
        }
        NSLog(@"steps:", pedometerData.numberOfSteps);
   }]:
}


Solution 1:[1]

You likely moved on by now but for others, this is very likely a date issue.

My case was using QueryPedometerData() and misunderstanding FromTimeIntervalSinceNow(). I thought it meant subtracting a number of seconds from Now but where its actually the opposite.

Solution 2:[2]

I also came across with this problem. In my case, the error was caused by the fact that the start date and the end date I provided to the CMPedometer were the same (for example, start date - 12:59:59 and the end date - 12:59:59). As I set the end date manually, inclusion of nanoseconds in the end date solved the problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Isaack Rasmussen
Solution 2 Tomas