Skip to content

🐞 [iOS] registerOneOffTask passes uniqueName as taskName in callback β€” parameters appear swappedΒ #670

@mmartin-12

Description

@mmartin-12

Description

When registering a one-off task via Workmanager().registerOneOffTask(uniqueName, taskName, ...), the taskName value received in the executeTask callback is correct on Android but incorrect on iOS. On iOS the callback receives uniqueName where taskName is expected.


Steps to reproduce

Register a task with distinct values for both parameters:

await Workmanager().registerOneOffTask(
  'uniqueName',  // unique identifier
  'taskName',    // task name used in callback
  initialDelay: Duration(seconds: 5),
);

In the callback, log or display the received taskName:

Workmanager().executeTask((taskName, inputData) async {
  print("Task: $taskName"); // "taskName" on Android, "uniqueName" on iOS
  return Future.value(true);
});

Expected behaviour

The callback parameter taskName should receive the value 'taskName' (second argument) on both Android and iOS.


Actual behaviour

  • Android: callback receives "taskName" βœ“
  • iOS: callback receives "uniqueName" βœ— β€” the first parameter is passed instead of the second.

Environment

Version
Flutter ^3.11.0
workmanager ^0.9.0+3

Additional context

This is likely a parameter mapping issue in the iOS native bridge. On Android, uniqueName and taskName are registered and forwarded separately; the iOS implementation appears to forward uniqueName in place of taskName when invoking the Dart callback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions