Instance Method


Recovers an active workout session.


- (void)recoverActiveWorkoutSessionWithCompletion:(void (^)(HKWorkoutSession *session, NSError *error))completion;


If your app crashes during an active workout session, the system calls your extension delegate’s handleActiveWorkoutRecovery method the next time your app launches. To recover the workout session, call recoverActiveWorkoutSessionWithCompletion: from your extension delegate’s handleActiveWorkoutRecovery method. HealthKit then attempts to restore the previous workout session, returning either a new session object or an error to the completion block.

As soon as you receive the session object, you must access its builder and set up your data source and delegates again, as described in Start a Session.

See Also

Managing Workouts

- addSamples:toWorkout:completion:

Associates the provided samples with the specified workout.

- splitTotalEnergy:startDate:endDate:resultsHandler:

Calculates the active and resting energy burned based on the total energy burned over the given duration.