Skip to content

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

Open
@sinhpn92

Description

@sinhpn92

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

Activity

Petra-Nieman

Petra-Nieman commented on May 21, 2024

@Petra-Nieman

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

sinhpn92 commented on May 21, 2024

@sinhpn92
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

teenrage-dev commented on Jun 10, 2024

@teenrage-dev

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

sinhpn92 commented on Jul 29, 2024

@sinhpn92
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?

bhattishb92

bhattishb92 commented on Nov 18, 2024

@bhattishb92

any update? it doesnt trigger the periodic task and print not working in dispatcher

teenrage-dev

teenrage-dev commented on Apr 2, 2025

@teenrage-dev

@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?

No, I didn't find a solution except to trust the words of what Apple wrote, that is, it does run at different times, known only to Apple, I think there are other workarounds, but you need to dig into it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      🐞[Background Processing Task not working on iOS] · Issue #557 · fluttercommunity/flutter_workmanager