Schedules and executes iOS background work with BGTaskScheduler and background URLSession. Use for app refresh, processing, continued-processing tasks, expiration and completion handling, background downloads, background pushes, registration, Info.plist configuration, or launch simulation.
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Register, schedule, and execute background tasks on iOS using BackgroundTasks (BGTaskScheduler), background URLSession, and background push notifications. Targets Swift 6.4 / iOS 26+.
Every task identifier must be declared in Info.plist under BGTaskSchedulerPermittedIdentifiers, or submit(_:) throws BGTaskScheduler.Error.Code.notPermitted.
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.example.app.refresh</string>
<string>com.example.app.db-cleanup</string>
<string>com.example.app.export.*</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string> <!-- Required for BGAppRefreshTask -->
<string>processing</string> <!-- Required for BGProcessingTask -->
<string>remote-notification</string> <!-- Required for silent push -->
</array>In Xcode: Target > Signing & Capabilities > Background Modes > enable Background fetch, Background processing, or Remote notifications.
| Task Type | Max Duration | Trigger | Requires Power/Network | Use Case |
|---|---|---|---|---|
BGAppRefreshTask | ~30 seconds | System opportunistic | Configurable hint | Light feed/state updates |
BGProcessingTask | Several minutes | Device idle | External power / network optional | Database cleanup, maintenance, ML indexing |
BGContinuedProcessingTask | User bounded | Foreground user action | Live Activity progress | Exporting large media, offline bundle generation |
URLSession.background | Managed out-of-process | Network completion | Cellular/WiFi policy | Large file downloads and uploads |
| Silent Remote Push | ~30 seconds | APNs trigger (content-available: 1) | Network required | Server-driven data invalidation hint |
application(_:didFinishLaunchingWithOptions:) (UIKit) or App.init() (SwiftUI). Submitting an unregistered identifier throws runtime exceptions.expirationHandler: The system can revoke background execution time at any moment. The expiration handler must cancel active tasks and call setTaskCompleted(success: false).setTaskCompleted(success:) exactly once: Failing to call completion causes the system to penalize future execution allocations.earliestBeginDate as a lower bound: iOS determines actual launch time based on battery status, power state, and user interaction patterns._simulateLaunchForTaskWithIdentifier:), read Debugging Background Tasks.handleEventsForBackgroundURLSession, read Background URLSession Extended Patterns.ProgressReporting, read BGContinuedProcessingTask Patterns.com.apple.developer.background-tasks.continued-processing.inference.UIScene.extendStateRestoration and UIScene.completeStateRestoration extend state restoration across background-to-foreground transitions.NSBundleResourceRequest are deprecated; use Background Assets. Background Assets adds localized asset packs, delivered by the user's preferred languages.Sources: https://sosumi.ai/documentation/ios-ipados-release-notes/ios-ipados-27-release-notes
BGTaskSchedulerPermittedIdentifiers (throws .notPermitted).task.setTaskCompleted(success:) on all execution and failure paths.task.expirationHandler, leading to watchdog termination when background time expires.URLSession (requires delegate).BGTaskSchedulerPermittedIdentifiersUIBackgroundModes enabled (fetch, processing, remote-notification)expirationHandler cancels active tasks and reports failuresetTaskCompleted(success:) called exactly once on all code pathsURLSession uses delegate and preserves background completion handlerurlSession(_:downloadTask:didFinishDownloadingTo:) before returncontent-available: 1, apns-push-type: background, and priority 5thienqo/ios-skills
6bf8b62
Canonical home
since May 23, 2026
Also appears in
on Oct 29, 2026
since May 22, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.