-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Labels
bugSomething isn't workingSomething isn't working
Description
- I have read the README
- I have done the setup for Android
- I have done the setup for iOS
- I have ran the sample app and it does not work there
Version
| Technology | Version |
|---|---|
| Workmanager version | 0.9.0+3 |
| Xcode version | 26.2 |
| Swift version | 6.2.3 |
| iOS deployment target | 26 (minimum 14) |
Describe the error
On iOS, following Option A in Quick Start, and executing registerPeriodicTask from Flutter, causes the following error messages (visible by debugging though XCode):
com.yourapp.YOUR_TASK_NAME is not advertised in the application's Info.plist
Could not schedule BGAppRefreshTask The operation couldn’t be completed. (BGTaskSchedulerErrorDomain error 3.)
Adding BGTaskSchedulerPermittedIdentifiers to Info.plist causes, however, another error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No launch handler registered for task with identifier com.yourapp.YOUR_TASK_NAME'
In fact, task gets scheduled through BGTaskScheduler.shared.submit before it's actually registered through BGTaskScheduler.shared.register.
Workaround:
- Add
BGTaskSchedulerPermittedIdentifierstoInfo.plistand, in its array, addcom.yourapp.YOUR_TASK_NAME - Add the following to
AppDelegate.swift(ref: Option C step 2)
import workmanager_apple
WorkmanagerPlugin.registerPeriodicTask(
withIdentifier: "com.yourapp.YOUR_TASK_NAME",
frequency: NSNumber(value: 20 * 60) // duration in seconds, same of the one set via flutter
)Output of flutter doctor
[✓] Flutter (Channel stable, 3.38.5, on macOS 15.7.3 24G419 darwin-arm64, locale
it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.2)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resources
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working