-
Notifications
You must be signed in to change notification settings - Fork 153
Open
Description
on ios when I start the task on foreground everything works fine
but when I goes into background nothing happen at all
after looking at the actual ios implementation for the BGTaskScheduler I found out that the registered BGRefresh operation do nothing except waiting 25 seconds
private static func handleAppRefresh(task: BGAppRefreshTask) {
let queue = OperationQueue()
let operation = AppRefreshOperation()
task.expirationHandler = {
operation.cancel()
}
operation.completionBlock = {
// Schedule a new refresh task
scheduleAppRefresh()
task.setTaskCompleted(success: true)
}
queue.addOperation(operation)
}
class AppRefreshOperation: Operation {
override func main() {
let semaphore = DispatchSemaphore(value: 0)
// avoid non-platform thread
DispatchQueue.main.asyncAfter(deadline: .now() + 25) {
semaphore.signal()
}
semaphore.wait()
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels