<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SensorKit",
  "identifier" : "/documentation/SensorKit/SRFetchRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SensorKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SRFetchRequest"
  },
  "title" : "SRFetchRequest"
}
-->

# SRFetchRequest

An object that defines the criteria for a sample query.

```
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`](/documentation/SensorKit/SRFetchRequest/from), [`to`](/documentation/SensorKit/SRFetchRequest/to)) specifies when the framework records the data. A fetch query can retrieve only sensor data that the app records by first calling [`startRecording()`](/documentation/SensorKit/SRSensorReader/startRecording()).

To execute a fetch request, an app passes the instance of this class to its sensor reader’s [`fetch(_:)`](/documentation/SensorKit/SRSensorReader/fetch(_:)) function.

The framework notifies the sensor reader’s [`delegate`](/documentation/SensorKit/SRSensorReader/delegate) upon fetch-request completion with [`sensorReader(_:didCompleteFetch:)`](/documentation/SensorKit/SRSensorReaderDelegate/sensorReader(_:didCompleteFetch:)). If the fetch fails, the framework calls the delegate’s [`sensorReader(_:fetching:failedWithError:)`](/documentation/SensorKit/SRSensorReaderDelegate/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

[`device`](/documentation/SensorKit/SRFetchRequest/device)

The device to query for sample data.

[`SRDevice`](/documentation/SensorKit/SRDevice)

A representation of a device that provides sample data.

### Defining the Time Range

[`from`](/documentation/SensorKit/SRFetchRequest/from)

Fetches sample information that occurs after this time.

[`to`](/documentation/SensorKit/SRFetchRequest/to)

Fetches sample information that occurs before this time.

[`SRAbsoluteTime`](/documentation/SensorKit/SRAbsoluteTime)

A value that describes when the system records the data.

[`current()`](/documentation/SensorKit/SRAbsoluteTime/current())

Provides the current absolute time.

[`SRAbsoluteTimeFromCFAbsoluteTime`](/documentation/SensorKit/SRAbsoluteTimeFromCFAbsoluteTime)

Provides an absolute time equivalent to the argument core-foundation absolute time.

[`SRAbsoluteTimeFromContinuousTime`](/documentation/SensorKit/SRAbsoluteTimeFromContinuousTime)

Provides an absolute time equivalent to the argument continuous time.

[`toCFAbsoluteTime()`](/documentation/SensorKit/SRAbsoluteTime/toCFAbsoluteTime())

Converts an absolute time to a core-foundation absolute time.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)