Which BGTaskScheduler request, continued-processing task, background URLSession or UIKit extra time should an iOS lead set as the default for each kind of background work?
answer
- who starts the work
- how long, and how late is acceptable
- what the person sees
- one refresh slot, shared
basics
~20 sMap work to mechanism by who starts it and how long it runs: app refresh for small updates, processing for maintenance, continued processing for long jobs a person starts, background URLSession for transfers, UIKit extra time for short finishing work.
solid answer
~50 sThere's no single answer, but there is a rule a team can enforce. Work the app chooses to do goes to the scheduler: small content updates to a `BGAppRefreshTaskRequest`, a short run at a time the system picks, and minutes of maintenance to a `BGProcessingTaskRequest` that waits for an idle device and can require power or network. Work a person starts and waits for goes to a `BGContinuedProcessingTaskRequest` on iOS 26 and later, which is visible in a Live Activity and cancellable. Large uploads and downloads go to a background URLSession. A few seconds of finishing work goes to UIKit's `beginBackgroundTask(withName:expirationHandler:)`. The costs differ in when the work runs, what the person sees and what each adds to Info.plist and entitlements. Because only one refresh request can be pending, a single owner should multiplex features into it.
go deeper
Recall which mechanism fits which job: refresh for small updates, processing for maintenance, continued processing for a job the person starts, and UIKit extra time for finishing a short task.
Explain what each mechanism needs: background modes, permitted identifiers, a person's action, a background session, or a balanced begin and end call.
Show you can predict how each mechanism fails in the field, such as late launches, terminated processing runs, cancelled exports or killed apps, and design each feature to survive it.
Own the default and its costs: one identifier owner, a shared refresh handler, continued processing only behind a person's action, a pre-iOS 26 fallback, and telemetry that shows whether each choice delivers.
## The decision a lead owns Every iOS feature with background work picks a mechanism, and if each engineer picks alone the app ends up with late registrations, colliding refresh identifiers, invisible jobs the person waits on and visible jobs nobody asked for. A lead's job is to set a **default per kind of work**, write down what each costs, and give the app **one owner** for background identifiers. The choice turns on three questions: who starts the work, how long it runs, and how late it may finish. ## The menu | Mechanism | Who starts it | When it runs | What the person sees | What it adds | |---|---|---|---|---| | `BGAppRefreshTaskRequest` | The app | When the system chooses; short | Nothing | `fetch` mode, a permitted identifier | | `BGProcessingTaskRequest` | The app | Idle device, optionally on power or network; minutes | Nothing | `processing` mode, a permitted identifier | | `BGContinuedProcessingTaskRequest` (iOS 26) | A person's tap | Now, or queued | A Live Activity with progress and cancel | Wildcard identifier; GPU entitlement if needed | | Background URLSession | The app or a person | The system runs the transfer, even while the app is suspended | Nothing by itself | A background session configuration | | UIKit `beginBackgroundTask(withName:expirationHandler:)` | Any code | Right away, for a limited time | Nothing | No configuration | ## The podcast app mapped - **Episode list refresh overnight**: app refresh. Small, unrequested, fine if late. - **Download cache cleanup**: processing with `requiresExternalPower` set to `true`. Heavy, deferrable, and it must tolerate being stopped when the listener picks up the phone. - **Transcript export the listener starts**: continued processing on iOS 26 and later, with honest progress, because the listener is waiting and can see it. - **Episode audio downloads**: a background URLSession, which the URLSession lesson covers. - **Saving the playback position as the app closes**: UIKit extra time, ended the moment the write finishes. ## Rules worth enforcing 1. **One module owns every identifier.** It holds the `BGTaskSchedulerPermittedIdentifiers` list, registers every handler once during launch, and submits requests. Features ask it for work; they never call `register(forTaskWithIdentifier:using:launchHandler:)` themselves. 2. **One refresh identifier, multiplexed.** The scheduler allows only one pending refresh request, so a second feature with its own refresh identifier gets `tooManyPendingTaskRequests`. Features contribute steps to the shared refresh handler instead. 3. **Every handler uses the same wrapper**: resubmit first, cancel on expiry, save progress, complete once. 4. **Continued processing only behind a person's action**, with a fallback for releases before iOS 26. 5. **UIKit extra time is never a scheduler.** It finishes work in progress; it is not a way to keep the app alive for a sync. 6. **Everything is logged**: submit outcomes, launches, completions and expiries, so "it never runs" arrives with data. ## What each default costs - **App refresh** is cheap to set up and invisible, but the system decides how often it runs. A feature whose value depends on freshness also needs a foreground refresh path. - **Processing** buys minutes but gives up timing: the header says the system aims for the next two days if the app was used in the past week, and running tasks stop when the person starts using the device. Work must be resumable. - **Continued processing** is honest with the person, but visible: they can cancel it, it must report progress or be expired as stalled, and it needs iOS 26. On iOS 26 the owning module submits it with the throwing `submit(_:)`, because `submitTaskRequest(_:)` arrives only in iOS 27. - **Background URLSession** hands the transfer to the system, but the app's code need not be running while it completes, so post-processing waits until the app is next woken or opened. - **UIKit extra time** costs nothing to adopt but is short, and an unbalanced call gets the app killed. These are judgment calls with real tradeoffs. A team building a media library might accept continued processing's visibility for every export; another might prefer resumable foreground work and skip the iOS 26 floor for now. ## Where the cross-platform reasoning lives Why every mobile OS defers and limits background work, and what a design may count on when it does, is covered in the mobile system design material on background limits. The Android counterpart of this decision, built on WorkManager, has its own lesson. This answer is the Apple-specific half: which API carries which job, and what it costs.
- Three features each want a background refresh in a BGTaskScheduler app; how do you structure it?One refresh identifier and one handler, owned by a scheduler module. The scheduler allows a single pending refresh request, so separate identifiers would hit `tooManyPendingTaskRequests`. Each feature registers a short step with the module, which runs the steps within the run's budget, in priority order, and completes the task once.
- When would you choose not to adopt BGContinuedProcessingTaskRequest even on iOS 26?When a job is short enough for UIKit extra time, when showing a cancellable Live Activity would confuse people for a background-feeling action, or when the team cannot keep progress reporting honest, since stalled tasks may be expired. Then resumable work with extra time is simpler.
- How do you tell, in production, whether the chosen mechanisms actually deliver?Log each submission result, each launch, each completion with its success flag and each expiry, keyed by identifier, and compare launch counts with what each feature expects. That turns 'it never runs' into rates per mechanism and per release.
- Put all background work in one processing task so there's one code path
- Use beginBackgroundTask repeatedly to keep the app alive for a long sync
- Large episode downloads belong inside a processing task's runtime
- Continued processing is a good way to run work nobody asked for
- Each feature should register and submit its own refresh identifier
Assumes the iOS 27 SDK; continued processing exists from iOS 26 on iOS and iPadOS, so a team supporting older releases needs a fallback path, and submitTaskRequest(_:) needs iOS 27, so submit(_:) stays behind #available below it.