◉RORK LABJP
●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
Articles/Dev Tools
⬡ Dev Tools/2026-09-05Advanced

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.

Rork622WidgetKit11BGTaskScheduler4iOS118Expo240App Extension3

✦ Premium Article

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.

CallFrom a widget extensionWhat actually happens
submitTaskRequest:error:AllowedThe request is accepted and you get true back
registerForTaskWithIdentifier:...Not allowedMarked 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 end
import BackgroundTasks
 
enum 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.plist
export 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 extension
public 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.

or
Unlock all articles with Membership →
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.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-05-28
Tracking Down BGTaskScheduler.submit Error Code=1 (Unavailable) in Rork iOS Apps
BGTaskScheduler Code=1 means unavailable, and Apple lists three causes: Background App Refresh turned off, running on Simulator, or submitting from an extension. Missing Info.plist entries show up as Code=3. A code-by-code triage table, the Expo identifier, a log-tally script, and a getPendingTaskRequests check.
⬡ Dev Tools2026-10-30
It runs in development but the iOS Release build dies on launch — checking whether a missing scheme is the cause
In an expo-router app, an app.json with no scheme can crash only the iOS Release build at launch. A triage table for Release-only crashes, how to read the reason from the log, why Debug and Android survive, the two fixes and why one needs a native rebuild, and a pre-submission check.
⬡ Dev Tools2026-09-21
A build that stops with exit code 0 — the flag that silenced the log, and the check that let an empty file through
Two reports landed in the same week: eas build --local stopping with exit code 0 but produced no further output, and a zero-byte stub that never got embedded. Both came down to settings that reduce output. Here is how to audit your own scripts.