diff --git a/workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift b/workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift index c09d6ac0..6e599e93 100644 --- a/workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift +++ b/workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift @@ -456,15 +456,17 @@ extension SwiftWorkmanagerPlugin: FlutterPlugin { if #available(iOS 13.0, *) { BGTaskScheduler.shared.getPendingTaskRequests { taskRequests in if taskRequests.isEmpty { - print("[BGTaskScheduler] There are no scheduled tasks") - result(true) + let str = "[BGTaskScheduler] There are no scheduled tasks" + print(str) + result(str) return } - print("[BGTaskScheduler] Scheduled Tasks:") + var str = "[BGTaskScheduler] Scheduled Tasks:" for taskRequest in taskRequests { - print("[BGTaskScheduler] Task Identifier: \(taskRequest.identifier) earliestBeginDate: \(taskRequest.earliestBeginDate?.formatted() ?? "")") + str += "\n[BGTaskScheduler] Task Identifier: \(taskRequest.identifier) earliestBeginDate: \(taskRequest.earliestBeginDate?.formatted() ?? "")" } - result(true) + print(str) + result(str) } } else { result(FlutterError(code: "99", diff --git a/workmanager/lib/src/workmanager.dart b/workmanager/lib/src/workmanager.dart index e52c0327..5337ce42 100644 --- a/workmanager/lib/src/workmanager.dart +++ b/workmanager/lib/src/workmanager.dart @@ -341,7 +341,7 @@ class Workmanager { /// development/debugging. /// /// Currently only supported on iOS and only on iOS 13+. - Future printScheduledTasks() async => + Future printScheduledTasks() async => await _foregroundChannel.invokeMethod("printScheduledTasks"); }