flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Passing parameter in inputData won't work in ios

Open neeluagrawal04 opened this issue 3 years ago • 3 comments

  • [x] I have read the README
  • [x] I have done the setup for iOS
  • [x] I have ran the sample app and it does not work there

Version

Technology - Ios Version - 2.17.1
Workmanager version 0.5.0
Xcode version 13.2.1
iOS deployment target 11.0

Describe the error Describe error using the below method for register the one off task and passing the inputData into it. While getting the data in callDispatcher handler returns null in ios code snippet: Workmanager().registerOneOffTask( 'test', 'test', inputData: { 'taskName': 'test', }, existingWorkPolicy: ExistingWorkPolicy.replace, constraints: Constraints( networkType: NetworkType.connected, ), );

handling callback:

Workmanager().executeTask((task, inputData) async { switch (task) { case Workmanager.iOSBackgroundTask: String taskName = inputData?['taskName']; // breaks over here print('>> task name '+ taskName);// always prints as null break; } return Future.value(true); });

// the print function always return null in ios but working fine in Android

neeluagrawal04 avatar May 17 '22 09:05 neeluagrawal04

hi @ened any update on this issue as clearly mentioned in documentation that inputData is supported in iOS but always getting null. Please update this issue.

neeluagrawal04 avatar May 24 '22 14:05 neeluagrawal04

(Major issue)

What about this issue : https://github.com/fluttercommunity/flutter_workmanager/issues/298 If inputData should be passed, the issue as mentioned should be closed.

ghost avatar Jun 02 '22 12:06 ghost

Pull request to fix this issue here : https://github.com/fluttercommunity/flutter_workmanager/pull/398

ghost avatar Jun 03 '22 14:06 ghost