Instance Method

initWithActivityType:locationType:

Returns a newly instantiated workout session.

Declaration

- (instancetype)initWithActivityType:(HKWorkoutActivityType)activityType locationType:(HKWorkoutSessionLocationType)locationType;

Parameters

activityType

The type of activity being performed in the workout. For a list of possible activities, see HKWorkoutActivityType.

locationType

A value indicating whether the workout was performed indoors or outdoors. For a list of possible location values, see HKWorkoutSessionLocationType.

Return Value

A newly initialized workout session object for the specified activity type and location.

Discussion

HealthKit uses the session’s workout activity and location type 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

- initWithConfiguration:error:

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