roadmap
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
Prepare for iOS interview questions on running work while your app is in the background. Covers app states and background limits, BGTaskScheduler refresh and processing tasks, expiry and testing.
16 of 16 questions in your plan: 0 known, 0 in progress, 0 due, 0 skipped, 16 new. 0 cut, outside your plan.
Background Tasks rarely gets a round of its own. It comes up in the platform conversation of an iOS loop, or in a mobile system design round when a feature must sync while nobody is looking at the screen. The opening is often a timing puzzle: a refresh submitted with an `earliestBeginDate` fifteen minutes out runs hours later, or not at all. The date is a floor, not an appointment; the system weighs battery, app usage and the Background App Refresh setting. Follow-ups go to the sharp edges. Why must a scheduled task's launch handler be registered before the app finishes launching? What does a missing `setTaskCompleted(success:)` cost after the expiration handler fires? When is the job not a scheduled task at all, because the user is still watching it and `beginBackgroundTask(withName:expirationHandler:)` fits better? Answers separate on what they assume. A weak one assumes the task runs, and runs to the end. A strong one plans for neither: work cut into resumable chunks so an expiry costs one chunk, the next request submitted from inside the handler, a silent push when the server, not the scheduler, should decide when to fetch, and a test that fires launch and expiry from the debugger instead of waiting a night.
The plan opens on ground every mobile OS shares. [App states](/topics/mob-system-design-client-architecture-lifecycle) come first, because a background task is delivered to a process the user did not open: the system may launch it from terminated or resume it from suspended, which is why a scheduled task's handler must exist before launch finishes. [Background time limits](/topics/mob-system-design-perf-budgets-background) follow with the policy the API enforces, deferrable work, minimum intervals and no promise of when, so a late or missing run reads as the system doing its job rather than a bug. Only then does the plan reach [the BackgroundTasks framework](/topics/mob-background-tasks), where those rules become code: identifiers declared in Info.plist, a handler registered for each, requests handed to the scheduler, a completion call that must beat expiry. The same topic covers finishing work as the app leaves the foreground, from a short grace period for a save to a continued processing task for a long export the user started. Taken last, each rule of the framework arrives with its reason in place.
If you ship iOS apps but have never scheduled work for later, read the limits topic before the framework: most wrong answers about the scheduler misread the policy, not the API. Then try it on a real device, since the debugger's launch and expiry commands do not work in the simulator. Android developers know this ground from WorkManager and should expect fewer promises, because here the system decides whether a request runs at all. With a plan this short, level is the control worth changing: a junior screen seldom goes past choosing a refresh or a processing request, so drop the top of the range; a senior candidate keeps it, for expiry, rescheduling and choosing another mechanism. The plan stays with work the scheduler launches. Background downloads handed to URLSession, the silent push that wakes an app on the server's schedule and the rest of the platform belong to the [iOS Developer roadmap](/roadmaps/ios); WorkManager is in the [Android Developer roadmap](/roadmaps/android).
Background Tasks rarely gets a round of its own. It comes up in the platform conversation of an iOS loop, or in a mobile system design round when a feature must sync while nobody is looking at the screen. The opening is often a timing puzzle: a refresh submitted with an earliestBeginDate fifteen minutes out runs hours later, or not at all. The date is a floor, not an appointment; the system weighs battery, app usage and the Background App Refresh setting.
Follow-ups go to the sharp edges. Why must a scheduled task's launch handler be registered before the app finishes launching? What does a missing setTaskCompleted(success:) cost after the expiration handler fires? When is the job not a scheduled task at all, because the user is still watching it and beginBackgroundTask(withName:expirationHandler:) fits better?
Answers separate on what they assume. A weak one assumes the task runs, and runs to the end. A strong one plans for neither: work cut into resumable chunks so an expiry costs one chunk, the next request submitted from inside the handler, a silent push when the server, not the scheduler, should decide when to fetch, and a test that fires launch and expiry from the debugger instead of waiting a night.
The plan opens on ground every mobile OS shares. App states come first, because a background task is delivered to a process the user did not open: the system may launch it from terminated or resume it from suspended, which is why a scheduled task's handler must exist before launch finishes. Background time limits follow with the policy the API enforces, deferrable work, minimum intervals and no promise of when, so a late or missing run reads as the system doing its job rather than a bug.
Only then does the plan reach the BackgroundTasks framework, where those rules become code: identifiers declared in Info.plist, a handler registered for each, requests handed to the scheduler, a completion call that must beat expiry. The same topic covers finishing work as the app leaves the foreground, from a short grace period for a save to a continued processing task for a long export the user started. Taken last, each rule of the framework arrives with its reason in place.
If you ship iOS apps but have never scheduled work for later, read the limits topic before the framework: most wrong answers about the scheduler misread the policy, not the API. Then try it on a real device, since the debugger's launch and expiry commands do not work in the simulator. Android developers know this ground from WorkManager and should expect fewer promises, because here the system decides whether a request runs at all.
With a plan this short, level is the control worth changing: a junior screen seldom goes past choosing a refresh or a processing request, so drop the top of the range; a senior candidate keeps it, for expiry, rescheduling and choosing another mechanism.
The plan stays with work the scheduler launches. Background downloads handed to URLSession, the silent push that wakes an app on the server's schedule and the rest of the platform belong to the iOS Developer roadmap; WorkManager is in the Android Developer roadmap.