Skip to content

🐞inputData on iOS is null #497

Open
@pbonikowska-derave

Description

@pbonikowska-derave
  • I have read the README
  • I have done the setup for Android
  • I have done the setup for iOS

Version

Technology Version
Workmanager version 0.5.1
Xcode version 14.2
Swift version 5.7.2
iOS deployment target 13.0

Describe the error

inputData is not working on iOS - when task executed I get null.

Code fragments:

await Workmanager().initialize(
  callbackDispatcher,
);

await Workmanager().registerOneOffTask(
  'fetchLocationTask',
  'fetchLocationTask',
  tag: orderId,
  initialDelay: const Duration(minutes: 1),
  constraints: Constraints(
  networkType: NetworkType.connected,
  ),
  inputData: <String, String>{'orderId': orderId},
);

In main.dart:

@pragma(
  'vm:entry-point',
)
void callbackDispatcher() {
  Workmanager().executeTask((task, inputData) async {
    DartPluginRegistrant.ensureInitialized();
    ...
}

When task executed on Android there is everything ok, but on iOS I get inputData = null.

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.10.6, on macOS 12.6 21G115 darwin-arm64, locale en-PL)
• Flutter version 3.10.6 on channel stable at /opt/homebrew/Caskroom/flutter/3.10.2/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f468f3366c (4 weeks ago), 2023-07-12 15:19:05 -0700
• Engine revision cdbeda788a
• Dart version 3.0.6
• DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/paulinabonikowska/Library/Android/Sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_HOME = /Users/paulinabonikowska/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.12.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.78.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.70.0

[✓] Connected device (4 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• iPhone (Paulina) (mobile) • ebda837e6194bfe3ab688b40e6e071ab353b3d62 • ios • iOS 15.7.6 19H349
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6 21G115 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.170

[✓] Network resources
• All expected network resources are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions