Class

HKObserverQuery

A long-running query that monitors the HealthKit store and updates your app when the HealthKit store saves or deletes a matching sample.

Declaration

@interface HKObserverQuery : HKQuery

Overview

Observer queries set up a long-running task on a background queue. This task watches the HealthKit store, and alerts you when the store saves or removes matching data. Your app uses observer queries to respond to changes made by other apps and devices.

Observer queries are immutable: You set their properties when you first create them, and you can’t change them.

Topics

Creating Observer Queries

Executing Observer Queries

Create and run observer queries.

- initWithSampleType:predicate:updateHandler:

Instantiates and returns a query that monitors the HealthKit store and responds to changes.

HKObserverQueryCompletionHandler

The completion handler for background deliveries.

Relationships

Inherits From

See Also

Common Query Types

HKSampleQuery

A general query that returns a snapshot of all the matching samples currently saved in the HealthKit store.

HKQuantitySeriesSampleQuery

A query that accesses the series data associated with a quantity sample.

HKAnchoredObjectQuery

A query that returns changes to the HealthKit store, including a snapshot of new changes and continuous monitoring as a long-running query.

HKCorrelationQuery

A query that performs complex searches based on the correlation’s contents, and returns a snapshot of all matching samples.

HKDocumentQuery

A query that returns a snapshot of all matching documents currently saved in the HealthKit store.

HKHeartbeatSeriesQuery

A query that returns the heartbeat data contained in a heartbeat series sample.

HKQuery

An abstract class for all the query classes in HealthKit.