fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to test BGTaskScheduler on Flutter?

nicolobozzato opened this issue · comments

I read the IOS setup very carefully and I would like to test my implementation.
So I arrived at this point
Testing BGTaskScheduler
and I read the instruction on apple website
https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development

The first point say
Set a breakpoint in the code that executes after a successful call to [submit(_:)](https://developer.apple.com/documentation/backgroundtasks/bgtaskscheduler/3142252-submit).

How is it possible to do that in flutter? it seems to me that I can run the subsequent command
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"TASK_IDENTIFIER"]
only in Xcode, but how can I put a breakpoint on the code that run after a successful call to [submit(:)]_ ?

Thank you

You can simply pause the app execution in Xcode's debugger, pass the command, wait for debugger's confirmation and resume the app. The task will be executed.