background-processing

Schedule and execute iOS background jobs with BGTaskScheduler and URLSession.

Updated May 6, 2026
One-click install
npx skills add https://github.com/Roy-wonji/claude-config --skill background-processing-roy-wonji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: background-processing
Source: https://github.com/Roy-wonji/claude-config/tree/main/skills/swift-ios-skills/skills/background-processing
Command: npx skills add https://github.com/Roy-wonji/claude-config --skill background-processing-roy-wonji

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

You need to schedule and execute background work on iOS without relying on the app staying in the foreground, while handling iOS constraints like permitted identifiers, expiration time, and completion reporting.

Core Features & Use Cases

  • BGTaskScheduler registration & scheduling: Register handlers before app launch and submit BGTask requests with correct identifiers.
  • Task-specific patterns: Use BGAppRefreshTask for short refreshes, BGProcessingTask for maintenance/cleanup, and BGContinuedProcessingTask (iOS 26+) for foreground-started work that continues in the background with progress reporting.
  • Background transfer + silent push: Use background URLSession downloads and silent push notifications to trigger brief background fetches reliably.
  • Debugging & guardrails: Include expiration handling, setTaskCompleted(success:), and provide debugging tips like simulating task launches.

Quick Start

Ask your assistant to “Create the complete iOS BackgroundTasks implementation for com.example.app.refresh and com.example.app.db-cleanup, including Info.plist configuration, scheduling, handler code with expiration handling, and task completion calls.”

Frequently Asked Questions about background-processing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I schedule and execute iOS background tasks using BGTaskScheduler?

iOS background tasks require registering handler closures before app launch finishes, submitting BGTaskRequest objects with matching Info.plist identifiers, handling expiration via expirationHandler, and calling setTaskCompleted(success:) to report results.

What is the difference between BGAppRefreshTask and BGProcessingTask for background work?

BGAppRefreshTask handles short background fetches for quick data updates, while BGProcessingTask executes longer maintenance workloads like database cleanup. Both require expirationHandler cancellation and setTaskCompleted(success:) calls to properly report task completion.

How do I handle BGTaskExpiration and background task time limits in iOS?

Handle BGTaskExpiration by setting an expirationHandler closure on your task that immediately cancels ongoing operations. Always conclude by calling setTaskCompleted(success:) to notify the system, whether work finished naturally or was interrupted by expiration.

How do I trigger background fetches with silent push notifications on iOS?

Trigger background fetches with silent push by enabling the remote-notification UIBackgroundModes entry in Info.plist, receiving the push payload, and calling the provided fetchCompletionHandler to report completion status to the system.

Do I need to configure Info.plist permitted identifiers for iOS BackgroundTasks?

You must declare permitted task identifiers in Info.plist under the BackgroundTaskScheduler key. These strings must exactly match the identifiers used when registering handlers and submitting BGTaskRequest objects for BGAppRefreshTask and BGProcessingTask execution.

Why is my iOS background URLSession download not completing in the background?

Background URLSession downloads fail when delegate-based relaunch completion handling is missing. The system relaunches your app in the background to deliver completed transfers via delegate callbacks, requiring proper URLSessionDelegate implementation and completion handling.