Unhandled Exception: PlatformException(unhandledMethod("registerOneOffTask") error, Unhandled method registerOneOffTask, null, null)
- [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
same
please check your appdelegate.swift maybe u forgot to register the task
@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.