flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

Unhandled Exception: PlatformException(unhandledMethod("registerOneOffTask") error, Unhandled method registerOneOffTask, null, null)

Open ibrahimcss opened this issue 3 years ago • 3 comments

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

Version

Technology Version
Workmanager version ^0.5.0
Xcode version 13.3.1
Swift version
iOS deployment target 13

Describe the error Describe error Optionally provide the least amount of code that shows this behaviour. Ideally in the sample app.

Output of flutter doctor -v

ibrahimcss avatar Jun 11 '22 17:06 ibrahimcss

same

selimq avatar Jul 05 '22 08:07 selimq

please check your appdelegate.swift maybe u forgot to register the task

aldowisnupratama avatar Jul 29 '22 07:07 aldowisnupratama

@ibrahimcss or @selimq did you find a solution for this? I'm encountering this error and have been unable to determine the source yet.

Error details:

flutter: PlatformException(unhandledMethod("registerOneOffTask") error, Unhandled method registerOneOffTask, null, null)
flutter: 
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
<asynchronous suspension>
#2      Workmanager.registerOneOffTask (package:workmanager/src/workmanager.dart:192:7)
<asynchronous suspension>

Here's what I'm calling and doing so on a real iphone:

inputData ??= {};
inputData.addAll({
      taskKey : uniqueTaskName,
      tagKey : retryProcessTag
    });
await Workmanager().registerOneOffTask(
        "task-identifier",
        "retryProcess", // Ignored on iOS
        initialDelay: Duration(minutes: 30),
        constraints: Constraints(
          // connected or metered mark the task as requiring internet
          networkType: NetworkType.connected,
          // require external power
          requiresCharging: true,
        ),
        inputData: inputData // fully supported
    );

EDIT: I think the issue is that I have been trying to do this with a device below iOS 13 and this call only works with devices that are iOS 13+, unfortunately.

AdamBridges avatar Nov 06 '22 22:11 AdamBridges