ORKFileResult Class Reference

Inherits from ORKResult : NSObject
Declared in ORKResult.h

The ORKFileResult class is a result that references the location of a file produced during a task.

A file result is typically generated by the framework as the task proceeds. When the task completes, it may be appropriate to serialize the linked file for transmission to the server.

Active steps typically produce file results when CoreMotion or HealthKit are serialized to disk using a data logger (ORKDataLogger). Audio recording also produces a file result.

When you write a custom step, use files to report results only when the data is likely to be too big to hold in memory for the duration of the task. For example, fitness tasks that use sensors can be quite long and can generate a large number of samples. To compensate for the length of the task, you can stream the samples to disk during the task, and return an ORKFileResult object in the result hierarchy, usually as a child of an ORKStepResult object.

  contentType

The MIME content type of the result.

@property (nonatomic, copy, nullable) NSString *contentType

Discussion

For example, @"application/json".

Declared In

ORKResult.h

  fileURL

The URL of the file produced.

@property (nonatomic, copy, nullable) NSURL *fileURL

Discussion

It is the responsibility of the receiver of the result object to delete the file when it is no longer needed.

The file is typically written to the output directory of the task view controller, so it is common to manage the archiving or cleanup of these files by archiving or deleting the entire output directory.

Declared In

ORKResult.h