-
Notifications
You must be signed in to change notification settings - Fork 354
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem Description
When using flutter_workmanager on iOS, periodic tasks consistently receive inputData as null within the Workmanager().executeTask callback, despite being provided during registration. This issue is specific to iOS periodic tasks; Android periodic tasks and iOS one-off tasks function correctly.
Setup & Environment
-
Prerequisites Confirmed:
- README read
- Android setup done
- iOS setup done
- Sample app tested, issue reproducible there.
-
Workmanager Version: 0.7.0
-
Xcode Version: 16.1
-
Swift Version: 6.0.2
-
iOS Deployment Target: 18.1
Steps Taken & Observed Behavior
- iOS
AppDelegate.swiftRegistration:
A periodic task with identifier"my_task_name"is registered inAppDelegate.swift:WorkmanagerPlugin.registerPeriodicTask(withIdentifier: "my_task_name", frequency: NSNumber(value: 20 * 60))
Info.plistConfiguration:
The task identifier"my_task_name"is added toInfo.plist, and background processing and fetching capabilities are enabled.- Flutter
callbackDispatcherTask Registration:
Inside theWorkmanager().executeTaskcallback (which is triggered for the periodic task), the task is re-registered on the Flutter side withinputData:await Workmanager().registerPeriodicTask( "my_task_name", "my_task_name", frequency: const Duration(minutes: 20), initialDelay: const Duration(seconds: 30), existingWorkPolicy: ExistingWorkPolicy.replace, inputData: periodicAction.toInputData(), // periodicAction.toInputData() is confirmed to provide non-null data constraints: Constraints(networkType: NetworkType.connected), );
- Issue: When the periodic task executes on iOS, the
inputDatareceived in the DartexecuteTaskcallback is alwaysnull. - Suspected Cause: It's suspected that all executed periodic tasks originate from the initial iOS-side registration call, and subsequent
registerPeriodicTaskcalls from the Flutter side (which provideinputDataand other constraints) do not override or influence these tasks, even though logs indicate successful Flutter-side registration.
Relevant Logs & Diagnostics
-
Task Registration Logs (Example):
BGAppRefreshTask submitted my_task_name earliestBeginInSeconds:30.0 flutter: Registered periodic task "my_task_name" for widget 5 (storm_map) -
flutter doctor -vOutput:[✓] Flutter (Channel stable, 3.27.3, on macOS 15.5 24F74 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.3)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working