# Background Delivery: Why an App Is Not Always Told When Health Data Changes

By The Optimized Team (Product). Published: 2026-11-30T05:46:55.983758+00:00. Updated: 2026-11-30T05:46:56.708885+00:00.
Canonical: https://optimizedtracker.com/blog/healthkit-background-delivery-observer-query-not-every-change

An app that mirrors Apple Health is woken at most once per interval, and the wake-up carries no samples. Why a missed or merged notification is normal, and how an app catches up.

An app that watches Apple Health is not told about every change as it happens. HealthKit wakes the app at most once per interval the app chose, several changes can arrive as a single wake-up, and the wake-up itself carries no data. It is a signal to go and look, not a list of what changed.

If you keep a log that another app mirrors, this explains why a new entry can show up late, or why two edits show up together. That's expected behavior, not a fault in your log.

## What an observer query tells the app

An observer query is a long-running query that, in Apple's words, [monitors the HealthKit store and updates your app when the store saves or removes matching data](https://developer.apple.com/documentation/healthkit/hkobserverquery). It also fires for changes made by other apps and devices, which is the point: your phone, your watch and a second app can all write to the same store.

What it does not do is hand over the changes. The update handler receives the query, a completion handler and an error. It does not receive samples, and it does not receive an anchor. So the observer answers one question: did something matching change? It says nothing about what changed, how many entries, or whether any were deleted.

That distinction matters for a record. One "something changed" wake-up can't update a mirrored log on its own. The app has to ask a second question afterward.

It helps to think of the observer as a doorbell. It tells you someone is at the door, but not who, and not how many people are waiting behind them. Ringing twice within the same interval can sound exactly like ringing once.

## Frequency and per-type caps

An app asks for background wake-ups with `enableBackgroundDelivery`, and it passes a frequency. [Apple documents four values](https://developer.apple.com/documentation/healthkit/hkupdatefrequency):

| Frequency | What the system does |
|---|---|
| immediate | Launches the app every time it detects a change |
| hourly | Launches the app at most once an hour |
| daily | Launches the app at most once a day |
| weekly | Launches the app at most once per week |

The wording is "at most," and it is deliberate. [The documentation for enabling background delivery](https://developer.apple.com/documentation/healthkit/hkhealthstore/enablebackgrounddelivery(for:frequency:withcompletion:)) says the system wakes the app at most once per period. If three entries are saved inside one hour and the app asked for hourly delivery, that is one wake-up, not three.

The requested frequency is also a ceiling on what you can ask for, not a promise. Apple notes that some sample types have a maximum frequency of hourly, and that the system enforces this transparently. On iOS, step count samples have an hourly maximum. On watchOS, most data types are hourly too, with a short list that can be delivered immediately. Apple names heart rhythm events, VO2 max and handwashing events among them. Background updates on the watch also share a budget with background refresh tasks: four updates an hour, and only while the app has a complication on the active watch face.

A few setup details from the same page:

- On iOS 15 and later, the app needs the `com.apple.developer.healthkit.background-delivery` entitlement. Without it, the call fails with an authorization error.
- Correlation types are not supported for background delivery.
- Observer queries should be created when the app launches, in `application(_:didFinishLaunchingWithOptions:)`, so they exist before HealthKit delivers anything.
- Background queries are not supported on the Simulator, so they have to be tested on a real device.

## The completion handler and backoff

Each wake-up comes with a completion handler, and the app must call it once it has finished processing. Apple explains why: calling it tells HealthKit the delivery succeeded. If the app does not call it, HealthKit keeps trying to launch the app with a backoff algorithm that lengthens the delay between attempts. If the app fails to respond three times, HealthKit assumes it cannot receive data and stops sending background updates.

So a missed wake-up is not always about timing. An app that crashes mid-processing, or forgets the handler, can quietly lose its background updates. From the outside, the log simply stops syncing.

## What to do after the wake-up

Because the observer carries no data, an app pairs it with an anchored object query. That query returns [an anchor value that corresponds to the last sample or deleted object it received](https://developer.apple.com/documentation/healthkit/hkanchoredobjectquery), and a later query can use that anchor to get only newer saved or deleted objects. Saved samples and deleted objects arrive as two separate lists.

The sequence an app follows looks like this:

1. The observer fires and the app wakes.
2. The app runs an anchored query from the last anchor it stored.
3. It applies the new samples and the deletions to its own copy.
4. It stores the new anchor.
5. It calls the completion handler.

For the mechanics of the anchor itself, see [anchors in HealthKit incremental sync](/blog/healthkit-anchored-object-query-read-only-what-changed). For the deletion side, see [how an app finds out about a deleted entry](/blog/healthkit-deleted-objects-how-an-app-finds-out).

## Why a missed wake-up should not lose data

Since wake-ups can merge, arrive late or stop altogether, a mirrored log should never depend on receiving one notification per change. The safe design uses the observer as a prompt and the stored anchor as the source of truth. When the app next launches, it runs the anchored query again from its saved anchor and picks up everything it missed in the meantime.

Anchors only cover what the store still remembers, so an app that cares about history is better off keeping [its own change history](/blog/deletion-records-expire-keep-your-own-change-history) rather than relying on HealthKit to replay it.

## What to record

When you compare a log against a mirrored copy, a few notes make the difference auditable:

- The time you wrote the entry, separate from the time of the event.
- Which app or device wrote it.
- Whether you edited or deleted it afterward, and when.
- The time you last saw the mirrored copy agree with the original.

Keep these notes short, but keep them consistent, because a note you cannot compare across weeks is not much use. A short gap between the two copies is normal. A gap that does not close after the other app has been opened is worth checking, starting with its Health permissions and background refresh settings.
