ORKRecorderConfiguration Class Reference

Inherits from NSObject
Conforms to NSSecureCoding
Declared in ORKRecorder.h

The ORKRecorderConfiguration class is the abstract base class for recorder configurations that can be attached to an active step (ORKActiveStep).

Recorder configurations provide an easy way to collect CoreMotion or other sensor data into a serialized format during the duration of an active step. If you want to filter or process the data in real time, it is better to use the existing APIs directly.

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.

To add a new recorder, subclass both ORKRecorderConfiguration and ORKRecorder, and add the new ORKRecorderConfiguration subclass to an ORKActiveStep object.

Other Methods

  identifier

A short string that uniquely identifies the recorder configuration within the step.

@property (nonatomic, copy, readonly) NSString *identifier

Discussion

The identifier is reproduced in the results of a recorder created from this configuration. In fact, the only way to link a result (an ORKFileResult object) to the recorder that generated it is to look at the value of identifier. To accurately identify recorder results, you need to ensure that recorder identifiers are unique within each step.

In some cases, it can be useful to link the recorder identifier to a unique identifier in a database; in other cases, it can make sense to make the identifier human readable.

Declared In

ORKRecorder.h

– recorderForStep:outputDirectory:

Returns a recorder instance using this configuration.

- (nullable ORKRecorder *)recorderForStep:(nullable ORKStep *)step outputDirectory:(nullable 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

– requestedHealthKitTypesForReading

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

- (nullable NSSet<HKObjectType*> *)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

Extension 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

– initWithCoder:

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

- (instancetype)initWithCoder:(NSCoder *)aDecoder

Parameters

aDecoder

Coder from which to initialize the recorder configuration.

Return Value

A new recorder configuration.

Declared In

ORKRecorder_Private.h

– requestedPermissionMask

Returns the permission mask indicating the permissions required for this configuration.

- (ORKPermissionMask)requestedPermissionMask

Discussion

This method is typically overridden in new recorder configuration subclasses.

Declared In

ORKRecorder_Private.h