Welcome to kmpworkmanager Discussions! #8
Replies: 6 comments 4 replies
|
Hey there, I would like to use it in our KMP app but I am struggling with registering the task execution on iOS platform. The problem is I can't find the correct library endpoint to delegate to. Am I missing something? Thank you! :) |
|
Hi @filipceko, thank you for reaching out! I have investigated the issue and confirmed that the documentation was indeed referencing an API that hadn't been fully exposed in the library yet. Good news: I have found the root cause and already implemented a fix in the upcoming v2.4.0 release. This includes a new native Kotlin API ( I am currently finalizing the code structure and running an extensive test suite on physical devices to ensure rock-solid stability. I will notify you here as soon as the new version is published. Stay tuned! |
|
i @filipceko, apologies for the confusion! v2.4.0 is now released and addresses this mismatch. The correct API is now IosBackgroundTaskHandler. You can delegate the task handling in your AppDelegate (or Kotlin code) like this: BGTaskScheduler.shared.register(forTaskWithIdentifier: "your-task-id", using: nil) { task in We've also added a Simulator Fallback in this version so tasks will execute immediately during local testing. Details: v2.4.0 Migration Guide (https://github.com/brewkits/kmpworkmanager/blob/main/docs/MIGRATION_V2.4.0.md) |
|
Hello, I try to schedule some tasks that are generated at runtime. Something like you have shown in the example: The problem is that on iOS I would have to register every possible task with photo ID. I could just provide the ID in the task parameters but then the scheduler will treat the tasks as the same task. Is there a way to work around this? |
Draft Response for GitHub Discussion #8Hi @filipceko, Thank you for reporting this issue! You have encountered a fundamental limitation in how Apple designed Unlike Android's WorkManager, iOS requires all background task identifiers to be statically declared in the Furthermore, using a workaround where you declare a single static ID (e.g., 🛠 The Immediate Workaround (App-Level Dispatcher Pattern)To solve this right now without waiting for a library update, you need to implement a Dispatcher Pattern using a local queue:
We have just published a detailed guide on this limitation and the workaround here: iOS Dynamic Task Scheduling Guide 🚀 Our Future PlanWe completely agree that this is a frustrating platform disparity. KMP WorkManager should abstract this away! We are tracking this as a major architectural feature request for an upcoming minor/major release ( Thank you again for the feedback, and please let us know if the workaround helps in the meantime! |
|
🎉 Fully Resolved in v2.4.1: Seamless Dynamic Task Scheduling on iOS Hi everyone, I'm thrilled to announce that we have officially addressed this limitation in the latest v2.4.1 release! We’ve implemented a comprehensive architectural solution that makes iOS background scheduling as dynamic and flexible as Android’s WorkManager. 🚀 The Solution: App-Level "Master Dispatcher"Instead of forcing you to register every single task ID in your Info.plist, we’ve introduced an internal routing layer.
⚡ Key Improvements in v2.4.1:
📦 Get Started:Update your dependencies to version 2.4.1. Check out the updated documentation on iOS Dynamic Task Scheduling for full implementation details. Thank you for the great discussion that pushed this library to a new level of maturity! |
Uh oh!
There was an error while loading. Please reload this page.
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
All reactions