●EXPO 58.1 — expo@58.1.1 (12/2) moves Metro to 0.88.1. Expo's default config ships with the new features it doesn't support yet turned off●XMAS PET — Rork's chat pet wears winter outfits from 12/1 to 1/10. Turn on Pet under Preferences in Settings to see it●FLASH END — Introductory Gemini Flash pricing ends on 12/31, 26 days away. A good time to recheck what your app's AI features cost●AUTH LINK — Some report Android sign-ins not returning to the app through an App Link. Checking the expo-web-browser version is the question●ENROLL — Enrolling in the Apple Developer Program as an individual or an organization changes your store name and how easily you can transfer apps●SDK 27 — From April 2027, App Store Connect uploads need the iOS 27 SDK or later. Starting in January leaves enough time●EXPO 58.1 — expo@58.1.1 (12/2) moves Metro to 0.88.1. Expo's default config ships with the new features it doesn't support yet turned off●XMAS PET — Rork's chat pet wears winter outfits from 12/1 to 1/10. Turn on Pet under Preferences in Settings to see it●FLASH END — Introductory Gemini Flash pricing ends on 12/31, 26 days away. A good time to recheck what your app's AI features cost●AUTH LINK — Some report Android sign-ins not returning to the app through an App Link. Checking the expo-web-browser version is the question●ENROLL — Enrolling in the Apple Developer Program as an individual or an organization changes your store name and how easily you can transfer apps●SDK 27 — From April 2027, App Store Connect uploads need the iOS 27 SDK or later. Starting in January leaves enough time
Your Widget Extension Can Submit a BGTaskScheduler Request. It Just Cannot Register the Handler
Calling BGTaskScheduler from a widget extension compiles, submits, and returns true — and then nothing runs. Here is why registration belongs to the host app only, and how I moved refresh ownership back where it belongs across my wallpaper apps.
The week after I finished chasing down a widget that froze on yesterday's image every evening, a new request arrived: the wallpaper should already be the next one by morning, even on days the app is never opened.
The obvious reading is that the widget owns the refresh. The widget is what draws the image, so the widget should fetch the next one — that was my reasoning when I added a BGAppRefreshTaskRequest to the widget extension target.
It compiled. submit returned true. The next morning the screen was unchanged, and it took me half a day to find out why.
Submit is allowed. Only register is refused
Here is the short version. BGTaskScheduler lets an extension ask for work, but it does not let an extension be the one that receives it. In the SDK header, registerForTaskWithIdentifier:usingQueue:launchHandler: carries an extension-unavailable annotation with a single line of explanation: "Only the host application may register launch handlers" (BGTaskScheduler.h in BackgroundTasks.framework).
The discussion text right below it adds that while some extensions may submit task requests, only the host app is ever launched to perform the background work. So a successful submit means "request accepted" and nothing more.
Apple's own reference for register(forTaskWithIdentifier:using:launchHandler:) adds that every launch handler must be registered before applicationDidFinishLaunching ends, and that registering the same identifier a second time gets the app killed. An extension has no such launch sequence, so there is structurally nowhere for the registration to go.
Call
From a widget extension
What actually happens
submitTaskRequest:error:
Allowed
The request is accepted and you get true back
registerForTaskWithIdentifier:...
Not allowed
Marked unavailable to extensions
Target that gets launched
—
The host app only; the extension is never woken
This is the code I wrote. It runs. There is simply nobody on the receiving end.
// WallpaperWidget/RefreshScheduler.swift — this design is a dead endimport BackgroundTasksenum RefreshScheduler { static func scheduleFromWidget() { let request = BGAppRefreshTaskRequest(identifier: "net.dolice.wallpaper.dailyRefresh") request.earliestBeginDate = Calendar.current.date(byAdding: .hour, value: 6, to: Date()) do { try BGTaskScheduler.shared.submit(request) // This line is reached. true comes back, the log says "scheduled". // But no launchHandler can be registered here, so nothing ever wakes up. NSLog("[widget] submitted dailyRefresh") } catch { NSLog("[widget] submit failed: \(error)") } }}
Because submit never throws here, the log only ever records success. Nothing crashes, so the problem stays invisible. Silent failures like this are the ones I have learned to distrust most.
The identifier allow-list lives in the app's Info.plist
There is a second wall waiting if you try to keep refresh inside the extension, and it is the permitted-identifier list.
BGTaskScheduler returns NotPermitted (Code=3) when the right mode is missing from UIBackgroundModes, or when the identifier is absent from BGTaskSchedulerPermittedIdentifiers. The detail that matters: that array belongs in the app's Info.plist. Reading it alongside the unavailable error code reference makes the split between Code=1 and Code=3 much clearer.
Adding it to the extension's Info.plist does nothing
It is tempting to select the widget extension target in Xcode and put BGTaskSchedulerPermittedIdentifiers in its Info.plist. I did exactly that once. No error appears. Nothing happens either.
On Rork and Expo projects, put it in app.config
Rork emits a React Native and Expo project, so rather than hand-editing Info.plist I keep this in the config file.
// app.config.js — this lands in the host app's Info.plistexport default { expo: { ios: { bundleIdentifier: "net.dolice.wallpaper", infoPlist: { UIBackgroundModes: ["fetch", "processing"], BGTaskSchedulerPermittedIdentifiers: [ "net.dolice.wallpaper.dailyRefresh" ] } } }};
BGAppRefreshTask needs fetch; processing is for BGProcessingTask. I list both because I also use expo-background-task later in this piece. If you only use one task type, keep only the mode it needs — it makes the capability easier to explain in review.
Define the identifier once and read it from both targets
If the identifier string drifts between the host app and the extension, register and submit end up pointing at different tasks, and that mismatch is silent too. I keep the constants in a shared target that both sides include.
// Shared/RefreshTaskID.swift — included in both the app and the widget extensionpublic enum RefreshTaskID { public static let daily = "net.dolice.wallpaper.dailyRefresh" public static let appGroup = "group.net.dolice.wallpaper" public static let widgetKind = "DailyWallpaperWidget"}
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦You will be able to tell within 5 minutes whether register or submit is the call your setup is not allowed to make, instead of losing half a day to a silent no-op
✦You will be able to separate the two budgets at play — the chance a BGAppRefreshTask gets to run, and WidgetKit's reload allowance — and design the handoff from host app to widget deliberately
✦You will know whether to inspect getPendingTaskRequests or your App Group write record first when submit returned true but the widget never changed
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
Once I accepted the dead end, I rewrote the design around a different subject. The host app owns the refresh. The widget goes back to being the thing that reads a result and draws it.
The app takes on three jobs in order: register at launch, pick the next image and write it into the App Group when it wakes, then ask WidgetCenter to reload once the write has landed.
// AppDelegate.swift — the host app; register can only happen hereimport BackgroundTasksimport WidgetKitfunc application(_ application: UIApplication, didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Finish before didFinishLaunching returns. Registering the same identifier twice gets the app killed. BGTaskScheduler.shared.register(forTaskWithIdentifier: RefreshTaskID.daily, using: nil) { task in handleDailyRefresh(task as! BGAppRefreshTask) } scheduleNextRefresh() return true}func scheduleNextRefresh() { let request = BGAppRefreshTaskRequest(identifier: RefreshTaskID.daily) // Ask for something too soon and the system rounds it into a window you did not intend. request.earliestBeginDate = Calendar.current.date(byAdding: .hour, value: 6, to: Date()) do { try BGTaskScheduler.shared.submit(request) } catch { NSLog("[app] submit failed: \(error)") }}func handleDailyRefresh(_ task: BGAppRefreshTask) { // Queue the next run first. Forget this and you get exactly one refresh, ever. scheduleNextRefresh() let work = Task { let picked = await DailyWallpaperPicker.pickNext() SharedStore.write(picked) // writes into the App Group container WidgetCenter.shared.reloadTimelines(ofKind: RefreshTaskID.widgetKind) task.setTaskCompleted(success: true) } task.expirationHandler = { work.cancel() task.setTaskCompleted(success: false) }}
The order of the write and the reload is not interchangeable. Call reloadTimelines first and the widget simply re-reads the old value. I got this backwards once and watched a symptom I had already fixed come back.
If you still need the extension to request work, keep submit there and leave register plus the handler in the host app. Thinking of it as requester and recipient rather than one owner makes the whole layout easier to hold in your head.
Two budgets, and confusing them will misdirect your debugging
There is a deeper point here that I misread for a long time. More than one budget is involved.
The first is whether a BGAppRefreshTask gets a chance to run at all, which is the system's call based on usage patterns, battery and connectivity. The second is how often WidgetKit will redraw a timeline; as the WidgetCenter reference notes, you can request a reload but immediate execution is not promised. Apple's "Keeping a widget up to date" puts a frequently viewed widget at roughly 40 to 70 refreshes a day, or about every 15 to 60 minutes (checked November 2026). Those are typical figures, not guarantees, and each widget instance gets its own budget.
Treat those as one budget and your diagnosis will drift. Here is how I tell them apart.
Symptom
Budget to suspect
Where to look first
The App Group write timestamp is not moving
BGAppRefreshTask side
getPendingTaskRequests and your last-run record
Timestamp is fresh but the display is stale
WidgetKit reload side
Where reloadTimelines is called, and your timeline entries
Fine in the morning, frozen by evening
WidgetKit reload side
Whether you batch a full day of entries in one timeline
The evening-freeze case is one I wrote up separately in why an iOS widget keeps showing stale data. What this article covers sits one layer earlier: who wakes up in the first place.
Do not trust a true from submit
To keep silent failures visible, I made both the scheduling and the execution report on themselves. Pending requests are readable through getPendingTaskRequests. Execution is recorded by writing a timestamp into the App Group from inside the handler and surfacing it on a debug screen.
// A self-reporting view I keep in the settings screen of development buildsimport BackgroundTasksimport SwiftUIstruct RefreshDiagnosticsView: View { @State private var pending: [String] = [] @State private var lastRun: Date? = SharedStore.lastRefreshAt() var body: some View { List { Section("Pending requests") { if pending.isEmpty { Text("None — submit may have returned true and the request still vanished") } else { ForEach(pending, id: \.self) { Text($0) } } } Section("Last run") { Text(lastRun.map { $0.formatted() } ?? "no record") } } .task { let requests = await BGTaskScheduler.shared.pendingTaskRequests() pending = requests.map(\.identifier) } }}
The reading order is fixed. Empty last-run timestamp means the host app is not waking, so I check the identifier and the Info.plist. Fresh timestamp with a stale display means it did wake, so I check the reload side instead. Splitting it into those two questions cut my debugging time noticeably.
When you do not need a background task at all, and how to choose when you do
After moving register into the host app, I stopped and asked a more basic question: does this refresh need a background task in the first place?
When the next item can be decided ahead of time — and for a wallpaper rotation it usually can — you can hand WidgetKit several days of timeline entries up front and let the system switch them on schedule. Nobody has to wake up. A background task only earns its place when the next item cannot be known until that moment: fetching something new from the network, or re-ranking based on what the user did yesterday.
Approach
Fits updates that
Main constraint
How it looks on Rork / Expo
Queue several days of timeline entries
Are known in advance
You can only show images available when the entries were built
Lives entirely in the widget extension's Swift
Host-app BGAppRefreshTask in Swift
Need a short fetch and a write
The system decides when and how often. Requires the fetch background mode
Touches AppDelegate, so inject it with a config plugin
expo-background-task in JavaScript
Reuse logic you already have in JS
Uses BGTaskScheduler on iOS with a fixed identifier; does not run in the simulator
A plugin entry plus a JS task definition
The decision fits in one line. If the next item can be decided now, queue it in the timeline; wake the host app only when it cannot. In my wallpaper app, slots with a known schedule moved to the timeline, and only the "fetch what's new" slot kept a background task. Waking the app less often also meant I stopped having to justify the battery cost to myself.
The timeline side can be as small as this. With policy: .atEnd, WidgetKit comes back for a fresh timeline once the queued entries run out.
// DailyWallpaperWidget/Provider.swift — a week of entries, no background taskimport WidgetKitstruct Provider: TimelineProvider { func getTimeline(in context: Context, completion: @escaping (Timeline<WallpaperEntry>) -> Void) { let calendar = Calendar.current let start = calendar.startOfDay(for: Date()) let entries: [WallpaperEntry] = (0..<7).compactMap { offset in guard let day = calendar.date(byAdding: .day, value: offset, to: start), let item = BundledSchedule.item(for: day) else { return nil } // read from the schedule return WallpaperEntry(date: day, item: item) } completion(Timeline(entries: entries, policy: .atEnd)) } // placeholder and getSnapshot omitted}
BundledSchedule here is a delivery schedule stored somewhere the extension can read — its own bundle or the App Group container. The host app only needs to call reloadTimelines when it rewrites that schedule; the rest is the system's job.
Putting register in the host app on a Rork / Expo project
Rork exports an Expo project, so if you hand-edit the AppDelegate under ios/, Continuous Native Generation (CNG) will regenerate it the next time you prebuild. I learned that the slow way: a register line I had added by hand vanished after a prebuild, and the widget was frozen again the following morning.
If JavaScript is enough, expo-background-task drives BGTaskScheduler from the host app for you. Per the Expo documentation (checked against the SDK 58 version, November 2026), iOS needs the processing background mode and the com.expo.modules.backgroundtask.processing identifier, and with CNG, prebuild adds both automatically. You do not write BGTaskSchedulerPermittedIdentifiers yourself.
For handing values to the widget, ExtensionStorage from @bacons/apple-targets — the package that adds the widget extension as a target — writes to the App Group's UserDefaults and can request a reload afterwards.
// src/background/dailyWallpaper.ts — define the task at module top levelimport * as BackgroundTask from 'expo-background-task';import * as TaskManager from 'expo-task-manager';import { ExtensionStorage } from '@bacons/apple-targets';import { pickNextWallpaper } from './picker';const TASK_NAME = 'daily-wallpaper-refresh';const storage = new ExtensionStorage('group.net.dolice.wallpaper');TaskManager.defineTask(TASK_NAME, async () => { try { const next = await pickNextWallpaper(); storage.set('nextWallpaper', JSON.stringify(next)); // write first storage.set('lastRefreshAt', Date.now()); // timestamp for self-reporting ExtensionStorage.reloadWidget('DailyWallpaperWidget'); // then ask for a reload return BackgroundTask.BackgroundTaskResult.Success; } catch { return BackgroundTask.BackgroundTaskResult.Failed; }});export async function enableDailyRefresh() { // Minutes. It will not run before this interval, but the system picks the actual time await BackgroundTask.registerTaskAsync(TASK_NAME, { minimumInterval: 60 * 6 });}
The split stays the same here: the extension reads, the host app wakes and writes. Even when the code is JavaScript, the thing being launched in the background is the host app.
Waking the task on a device right now
The gap between scheduling a background task and the system actually launching it can be hours. If you verify by waiting for the next morning, you get to test one hypothesis per day.
Apple's "Starting and Terminating Tasks During Development" describes how to trigger a launch from the debugger. Put a breakpoint on a line after a successful submit, run on a device, and when it pauses, run this and resume:
(lldb) e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"net.dolice.wallpaper.dailyRefresh"]
To exercise expiration, pause inside the handler and call _simulateExpirationForTaskWithIdentifier: the same way. You can then watch expirationHandler fire and confirm it reaches setTaskCompleted(success: false).
Two cautions from the same page. These debug functions only work on devices. And they are private, so use them during development only — the documentation says leaving references to them in an App Store submission is cause for rejection.
Run this against an identifier that was submitted from the extension, and no handler fires. You can confirm there is no recipient on the spot, without waiting for morning.
A symptom-first troubleshooting table
Here is everything above, rearranged so you can start from what you are seeing. When I am stuck, I read it top to bottom.
Symptom
Likely cause
How to check
Fix
submit returns true but the handler never runs
register lives in the extension, or the host app never registers
Run _simulateLaunchForTaskWithIdentifier on a device and see whether the handler breakpoint hits
Move register and the handler into the host app's didFinishLaunching
register returns false
The identifier is missing from the host app's BGTaskSchedulerPermittedIdentifiers
Open the host app's Info.plist under ios/ after prebuild and check the array
Add the identifier under ios.infoPlist in app.config and prebuild again
submit fails with NotPermitted (Code=3)
Missing background mode, or the identifier is not permitted
fetch for BGAppRefreshTask, processing for BGProcessingTask
Add the mode that matches the task type; read the identifier from the shared constant
The app is killed right after launch
The same identifier is registered twice
Check the crash log and count the places that call register
Register once, in one place, inside didFinishLaunching
The handler runs but the display is stale
Reload is requested before the write, or the WidgetKit budget is spent
Compare the App Group last-run timestamp with where reloadTimelines is called
Reload after the write; queue known content in the timeline
Nothing happens in the simulator
Background Tasks are not available in the simulator
Repeat the same steps on a device
Do all background-task verification on hardware
Three misconceptions worth correcting
The first is "if submit does not throw, the task will run." submit only means the request was accepted. Registering a recipient is a separate call, and an extension cannot make it.
The second is "the widget's allow-list goes in the widget's Info.plist." BGTaskSchedulerPermittedIdentifiers only matters in the Info.plist of whatever gets launched in the background — the host app.
The third is "calling reloadTimelines redraws the widget immediately." Apple's "Keeping a widget up to date" explains that reloads are distributed within a daily budget, so the call is a request, not a command. That same page also notes that reloads while the containing app is in the foreground do not count against the budget, which means bringing everything in sync the moment the app opens is something you can rely on.
Where interactive widgets stop short
Widgets can hold buttons from iOS 17 onward, so it is natural to want the image to change the moment one is tapped. Calling a reload from inside an AppIntent's perform(), though, has drawn repeated reports of minutes-long delays that reproduce only on device — one such thread on the developer forums collects several. My own results matched: instant in the simulator, a wait on hardware.
So I render the tap from the value I just wrote into the App Group, and let the system reload catch up afterwards. Responsiveness comes from my own write; correctness comes from the system's reload. Since splitting those two responsibilities, the simulator-versus-device gap has stopped costing me evenings.
The rules I kept after rolling this out across several apps
Rolling the same structure across several wallpaper apps, I wrote down three short rules so the decision would not wobble. Background refresh registration is the host app's job alone. Identifiers are read only from the shared constant. The reload request comes after the write, never before. And one I added later: anything that can be decided in advance goes into the timeline, not into a background task.
If you have a BGTaskScheduler call half-written in an extension target right now, try moving just the register line into the host app first. For me, relocating that single line was what finally made the morning screen change.
Thanks for staying with a problem this narrow. I hope the half day it cost me is one you get to keep.
Share
Thank You for Reading
Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.