Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞[Background Processing Task not working on iOS] #557

Open
sinhpn92 opened this issue May 20, 2024 · 4 comments
Open

🐞[Background Processing Task not working on iOS] #557

sinhpn92 opened this issue May 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@sinhpn92
Copy link

Hello,

I have integrated according to the instructions for iOS. I have also tried with the example project, but it doesn't work with registerProcessingTask. When I tried with registerOneOffTask, it worked, but registerProcessingTask did not. Has anyone encountered this issue on iOS?

I check the console log of device and receive the cancellation log:

15:09:38.380551+0700	Runner	submitTaskRequest: <BGProcessingTaskRequest: be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask, earliestBeginDate: 2024-05-20 08:09:41 +0000, requiresExternalPower=0, requiresNetworkConnectivity=0>
15:09:38.380904+0700	Runner	Submitting task request activity: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93
15:09:38.388829+0700	dasd	Daemon Canceling Activities: {(
    bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:751E8D
)}
15:09:38.389446+0700	dasd	CANCELED: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:751E8D at priority 10 <private>!
15:09:38.393362+0700	dasd	Submitted Activity: bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93 at priority 10 (Mon May 20 15:17:08 2024 - Mon May 27 15:17:08 2024)
15:17:08.728142+0700	dasd	bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93:[
	{name: DeviceActivityPolicy, policyWeight: 5.000, response: {Decision: Can Proceed, Score: 0.05}}
 ] sumScores:25.880000, denominator:30.630000, FinalDecision: Can Proceed FinalScore: 0.844923}
15:17:08.728425+0700	dasd	'bgProcessing-be.tramckrijte.workmanagerExample.iOSBackgroundProcessingTask:200A93' CurrentScore: 0.844923, ThresholdScore: 0.851473 DecisionToRun:0

My versions:

  workmanager:
    git:
      url: https://github.com/fluttercommunity/flutter_workmanager.git
      ref: b783000

Doctor:

[✓] Flutter (Channel stable, 3.19.5, on macOS 14.3.1 23D60 darwin-arm64, locale en-US)
    • Flutter version 3.19.5 on channel stable at /Data/flutter_sdk
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (8 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1
    
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.0
@sinhpn92 sinhpn92 added the bug Something isn't working label May 20, 2024
@Petra-Nieman
Copy link

Petra-Nieman commented May 21, 2024

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example
"iOS supports One off tasks with a few basic constraints:"

@sinhpn92
Copy link
Author

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example "iOS supports One off tasks with a few basic constraints:"

I saw registerProcessingTask in their example code, so I tried it. However, I did not see any trigger for this task. I looked up some documents about iOS Background Processing tasks. They say that the operating system decides when the task will be executed, and we cannot know when it will run; it depends on the operating system. It could be a few minutes later, a few hours later, or even a few days later. This is a real obstacle for data synchronization in the application. Is this true? Can anyone help me understand this better?

@teenrage-dev
Copy link

Looking at the documentation it seems that they might indicate ios works only with the one off task as this is the only sentence above the ios example "iOS supports One off tasks with a few basic constraints:"

I saw registerProcessingTask in their example code, so I tried it. However, I did not see any trigger for this task. I looked up some documents about iOS Background Processing tasks. They say that the operating system decides when the task will be executed, and we cannot know when it will run; it depends on the operating system. It could be a few minutes later, a few hours later, or even a few days later. This is a real obstacle for data synchronization in the application. Is this true? Can anyone help me understand this better?

Do you have any updates?

@sinhpn92
Copy link
Author

@teenrage-dev No, I am looking for the solution to solve. But It's doesn't working. Did you find any update or the lib to switch to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants