Contents

SRFetchRequest

An object that defines the criteria for a sample query.

Declaration

class SRFetchRequest

Overview

An app configures an instance of this class to select the device from which to query sensor data. The time range (from, to) specifies when the framework records the data. A fetch query can retrieve only sensor data that the app records by first calling startRecording().

To execute a fetch request, an app passes the instance of this class to its sensor reader’s fetch(_:) function.

The framework notifies the sensor reader’s delegate upon fetch-request completion with sensorReader(_:didCompleteFetch:). If the fetch fails, the framework calls the delegate’s sensorReader(_:fetching:failedWithError:).

SensorKit places a 24-hour holding period on newly recorded data before an app can access it. This gives the user an opportunity to delete any data they don’t want to share with the app. A fetch request doesn’t return any results if its time range overlaps this holding period.

Topics

Selecting the Device

Defining the Time Range

See Also

Querying data