ORKHealthQuantityTypeRecorderConfiguration Class Reference

Inherits from ORKRecorderConfiguration : NSObject
Declared in ORKHealthQuantityTypeRecorder.m
ORKRecorder.h

Overview

The ORKHealthQuantityTypeRecorderConfiguration class represents a configuration that records data from a HealthKit quantity type during an active step.

Before you can use this configuration, you must use Xcode to enable the appropriate HealthKit entitlement for your app.

HealthKit quantity type data is serialized to JSON and returned as an ORKFileResult object. For details on the format, see HKSample+ORKJSONDictionary.

To use a recorder, include its configuration in the recorderConfigurations property of an ORKActiveStep object, include that step in a task, and present it with a task view controller.

Other Methods

– initWithIdentifier:

Returns an initialized recorder configuration.

- (instancetype)initWithIdentifier:(NSString *)identifier

Parameters

identifier

The unique identifier of the recorder configuration.

Return Value

An initialized recorder configuration.

Discussion

This method is the designated initializer.

Declared In

ORKRecorder_Private.h

– initWithIdentifier:healthQuantityType:unit:

Returns an initialized health quantity type recorder configuration using the specified quantity type and unit designation.

- (instancetype)initWithIdentifier:(NSString *)identifier healthQuantityType:(HKQuantityType *)quantityType unit:(HKUnit *)unit

Parameters

identifier

The unique identifier of the recorder configuration.

quantityType

The quantity type that should be collected during the active task.

unit

The unit for the data that should be collected and serialized.

Return Value

An initialized health quantity type recorder configuration.

Discussion

This method is the designated initializer.

Declared In

ORKRecorder.h

– recorderForStep:outputDirectory:

Returns a recorder instance using this configuration.

- (ORKRecorder *)recorderForStep:(ORKStep *)step outputDirectory:(NSURL *)outputDirectory

Parameters

step

The step for which this recorder is being created.

outputDirectory

The directory in which all output file data should be written (if producing ORKFileResult instances).

Return Value

A configured recorder instance.

Declared In

ORKRecorder.h

– initWithCoder:

Returns a new health quantity type recorder configuration initialized from data in the given unarchiver.

- (instancetype)initWithCoder:(NSCoder *)aDecoder

Parameters

aDecoder

Coder from which to initialize the health quantity type recorder configuration.

Return Value

A new health quantity type recorder configuration.

Declared In

ORKRecorder.h

– requestedHealthKitTypesForReading

Returns the HealthKit types for which this recorder requires read access in a set of HKSampleType objects.

- (NSSet *)requestedHealthKitTypesForReading

Discussion

Typically, the task view controller automatically collects and collates the types of HealthKit data requested by each of the active steps in a task, and requests access to them at the end of the initial instruction steps in the task.

If your recorder requires or would benefit from read access to HealthKit at runtime during the task, return the appropriate set of HKSampleType objects.

Declared In

ORKRecorder.h

Other Methods

  quantityType

The quantity type to be collected from HealthKit. (read-only)

@property (nonatomic, readonly, copy) HKQuantityType *quantityType

Declared In

ORKRecorder.h

  unit

The unit in which to serialize the data from HealthKit. (read-only)

@property (nonatomic, readonly, copy) HKUnit *unit

Declared In

ORKRecorder.h