> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/data-api-sdk/webhooks-dedup-and-sync-reliability/ios-background-delivery-reliability-setup.md).

# How reliable is iOS background data delivery?

On iOS, background delivery is triggered by the OS when new HealthKit data is available, not on a fixed schedule. The documented behaviour is:

* It only fires while the **phone is unlocked**.
* It only fires where there is a **network connection**.
* It still fires when the **app is killed**, but at a **much lower frequency**.
* Only **enabled data types** from the Terra Dashboard are delivered.

Opening the app regularly tends to improve scheduling, since iOS prioritises frequently used apps.

**To make delivery as reliable as possible, confirm the setup:**

{% stepper %}
{% step %}
The HealthKit Background Delivery, Background Processing and Background Fetch capabilities are enabled in Xcode.
{% endstep %}

{% step %}
`Terra.setUpBackgroundDelivery()` is called once in your `AppDelegate`'s `didFinishLaunchingWithOptions`.
{% endstep %}

{% step %}
`co.tryterra.data.post.request` is listed in your `Info.plist` `BGTaskSchedulerPermittedIdentifiers`.
{% endstep %}

{% step %}
Per affected user, HealthKit permissions cover the requested data types (and, if you use `CustomPermissions`, the specific permissions required per group are granted).
{% endstep %}
{% endstepper %}

{% hint style="info" %}
On iOS the `schedulerOn` init parameter has **no effect**, background delivery is controlled by `setUpBackgroundDelivery()`. If a data post fails for lack of network, the SDK caches the payload and retries via `BGTaskScheduler` when connectivity returns.
{% endhint %}

Background delivery only sends future data. A [historical/backfill request](https://docs.tryterra.co/health-and-fitness-api/managing-user-health-data/requesting-historical-data) is a separate one-time sync. It can only return Apple Health data the SDK has access to on device, and runs when the app next has an active session.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/data-api-sdk/webhooks-dedup-and-sync-reliability/ios-background-delivery-reliability-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
