> 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.
