Class

HKObjectType

The abstract superclass for all classes that identify a specific type of data when working with the HealthKit store.

Declaration

@interface HKObjectType : NSObject

Overview

The HKObjectType class is an abstract class. You should never instantiate an HKObjectType object directly. Instead, you always work with one of the following concrete subclasses:

The HKObjectType class provides a convenience method to create each of these subclasses.

Using Object Types

Like many HealthKit classes, HealthKit object types are not extensible and should not be subclassed.

Additionally, wherever possible, this class uses a single instance to represent all copies of the same type. For example, if two calls to the quantityTypeForIdentifier: method are passed the same identifier, they return the same instance. Reusing object types helps reduce HealthKit’s overall memory usage.

Letting multiple HealthKit objects share the same object type instance helps reduce the overall memory usage.

Topics

Creating Quantity Types

+ quantityTypeForIdentifier:

Returns the shared quantity type for the provided identifier.

HKQuantityTypeIdentifier

Used to define the identifiers that create quantity type objects.

Creating Category Types

+ categoryTypeForIdentifier:

Returns the shared category type for the provided identifier.

HKCategoryTypeIdentifier

Identifiers for creating category types.

Creating Characteristic Types

+ characteristicTypeForIdentifier:

Returns the shared characteristic type for the provided identifier.

HKCharacteristicTypeIdentifier

Used to define the identifiers that create characteristic type objects.

Creating Correlation Types

+ correlationTypeForIdentifier:

Returns the shared correlation type for the provided identifier.

HKCorrelationTypeIdentifier

Used to define the identifiers that create correlation type objects.

Creating Workout Types

+ workoutType

Returns the shared HKWorkoutType object.

Creating Activity Summary Types

+ activitySummaryType

Returns the shared activity summary type.

Creating Audiogram Sample Types

+ audiogramSampleType

Returns an audiogram sample type.

Creating Clinical Record Types

+ clinicalTypeForIdentifier:

Returns the shared clinical type for the provided identifier.

Creating Series types

+ seriesTypeForIdentifier:

Returns the shared series type for the provided identifier.

Creating Document Types

+ documentTypeForIdentifier:

Returns the shared document type for the provided identifier.

HKDocumentTypeIdentifier

Used to define the identifiers that create document type objects.

Getting Property Data

identifier

A unique string identifying the HealthKit object type.

Relationships

Inherits From

See Also

Type Objects

HKCharacteristicType

A type that represents data that does not typically change over time.

HKQuantityType

A type that identifies samples that store numerical values.

HKCategoryType

A type that identifies samples that contain a value from a small set of possible values.

HKCorrelationType

A type that identifies samples that group multiple subsamples.

HKActivitySummaryType

A type that identifies activity summary objects.

HKAudiogramSampleType

A type that identifies samples that contain audiogram data.

HKSeriesType

A type that indicates the data stored in a series sample.

HKSampleType

An abstract superclass for all classes that identify a specific type of sample when working with the HealthKit store.

HKClinicalType

A type that identifies samples that contain clinical record data.

HKWorkoutType

A type that identifies samples that store information about a workout.