ORKFileResult Class Reference
Inherits from | ORKResult : NSObject |
---|---|
Declared in | ORKFileResult.h ORKFileResult.m |
Overview
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.
Other Methods
contentType
The MIME content type of the result.
@property (nonatomic, copy, nullable) NSString *contentType
Discussion
For example, @"application/json"
.
Declared In
ORKFileResult.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
ORKFileResult.h
Other Methods
– isSaveable
A boolean value indicating whether this result can be saved in a save and restore procedure.
- (BOOL)isSaveable
Discussion
This is currently considered a private method, but overriding the getter in a result is the correct way to prevent this result being considered as saveable for the purpose of deciding whether to offer a “Save” option when the user cancels a task in progress.
ORKResult
subclasses should return YES if they have data that the user
might want to be able to restore if the task were interrupted and later
resumed from the current state.
Declared In
ORKResult_Private.h