Incorrect endDate in CMPedometerData : <p>I design app with CMPedometer and have one strange problem. I have logs from my client and i look this CMPedometerData, that i think really incorrect and i cant understand why this is so</p>

<blockquote>
  <p>[2017-04-11 20:16:34 +0000] CMPedometerData, startDate 2017-04-11 20:16:32 +0000 endDate 2017-04-11 20:18:41 +0000 steps 3 distance 2.130000000004657 floorsAscended (null) floorsDescended (null) currentPace (null) currentCadence (null) averageActivePace 0></p>
</blockquote>

<p>As you can see my client (i cant reproduce this error) got pedometerData from method <code>startPedometerUpdatesFromDate</code> and endDate 2017-04-11 20:18:41 is bigger than now 2017-04-11 20:16:34 (it was first CMPedometerData after startPedometerUpdatesFromDate was launched after returning from background - <code>willEnterForeground</code> method). Maybe someone has already encountered a similar problem?</p>

<p>The part of my code:</p>

<pre><code>- (void)didEnterBackground {
    dispatch_async(dispatch_get_main_queue(), ^{
        [[Pedometer sharedInstance].motionActivityManager stopActivityUpdates];
        [[Pedometer sharedInstance].pedometer stopPedometerUpdates];
    });
}

- (void)willEnterForeground {
     NSDate *nowDate = [NSDate new];

     /* here is request to get historical data from lastDateUpdate (store in database) to now date */
     [[Pedometer sharedInstance] importDataFrom:lastDateUpdate endDate:nowDate completion:^{
          dispatch_async(dispatch_get_main_queue(), ^{
                /* show info */
          });
      }];    

     dispatch_async(dispatch_get_main_queue(), ^{
          [self startUpdatingData:nowDate];
     });

     lastDateUpdate = nowDate;
}

- (void)startUpdatingData:(NSDate *)fromDate {

    NSOperationQueue *activityQueue = [[NSOperationQueue alloc] init];
    [[Pedometer sharedInstance].motionActivityManager startActivityUpdatesToQueue:activityQueue withHandler:^(CMMotionActivity * _Nullable act) {
          ...
    }];

    [[Pedometer sharedInstance].pedometer startPedometerUpdatesFromDate:fromDate withHandler:^(CMPedometerData * _Nullable pedometerData1, NSError * _Nullable error) {
          ...
          NSLog(@"%@", pedometerData1);
          ...
          lastDateUpdate = pedometerData1.endDate;
          ...
    }];
}
</code></pre>
