Instance Method

initWithConfiguration:error:

Returns a newly instantiated workout session.

Declaration

- (instancetype)initWithConfiguration:(HKWorkoutConfiguration *)workoutConfiguration error:(NSError * _Nullable *)error;

Parameters

workoutConfiguration

A workout configuration object containing the configuration data for this workout session.

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing information about the error. Specify nil for this parameter if you do not want to receive error information.

Return Value

A newly initialized workout session object, or nil if an error occurred.

Discussion

HealthKit uses the session’s configuration data to fine tune Apple Watch’s sensors for the selected activity. All workout sessions generate higher-frequency heart rate samples; however, an outdoor cycling activity generates more accurate location data, while an indoor cycling activity does not.

See Also

Deprecated Methods

- initWithActivityType:locationType:

Returns a newly instantiated workout session.

Deprecated
activityType

The workout activity performed during this session.

Deprecated
locationType

A value that indicates whether the workout session occurred indoors or outdoors.

Deprecated