fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.
826 stars 247 forks source link

🐞Periodic Task are not working on iOS. #487

Closed anmolgupta321 closed 1 year ago

anmolgupta321 commented 1 year ago

Version

Technology Version
Workmanager version 0.5.1
Xcode version 14.3
Swift version 5.0
iOS deployment target 15.2

Describe the error When running the flutter app on iOS with workmanager configs, I am getting Platform exception error. Exact Error:

[log] PlatformException(unhandledMethod("registerPeriodicTask") error, Unhandled method registerPeriodicTask, null, null)
      PlatformException(unhandledMethod("registerPeriodicTask") error, Unhandled method registerPeriodicTask, null, null)
      #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
      #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
      <asynchronous suspension>
      #2      Workmanager.registerPeriodicTask (package:workmanager/src/workmanager.dart:228:7)
      <asynchronous suspension>

Output of flutter doctor -v

anmolgupta321 commented 1 year ago

@ened Does work manager package supports periodic task after every 15 mins on iOS?

emiliodallatorre commented 1 year ago

The plugin documentation clearly states that this is not supported. In addition, even with native code, iOS does not support the execution of a periodic background task.

ened commented 1 year ago

Maybe the plugin should print warnings in the console, or throw an exception if a developer attempts to use these APIs on iOS.