I am getting the following error using the breakpoints below. I'm not sure if that indicates anything. It doesn't appear that RefreshAppContentsOperation runs.
App.debug.dylib`partial apply for closure #1 in View.function():
-> 0x103aade10 <+0>: orr x29, x29, #0x1000000000000000
0x103aade14 <+4>: sub sp, sp, #0x20
0x103aade18 <+8>: stp x29, x30, [sp, #0x10]
0x103aade1c <+12>: str x22, [sp, #0x8]
0x103aade20 <+16>: add x29, sp, #0x10
0x103aade24 <+20>: ldr x9, [x22]
0x103aade28 <+24>: str x9, [sp]
0x103aade2c <+28>: mov x8, x29
0x103aade30 <+32>: sub x8, x8, #0x8
0x103aade34 <+36>: str x9, [x8]
0x103aade38 <+40>: ldr x0, [x9, #0x18]
0x103aade3c <+44>: ldr x8, [x22]
0x103aade40 <+48>: mov x10, x29
0x103aade44 <+52>: sub x10, x10, #0x8
0x103aade48 <+56>: str x8, [x10]
0x103aade4c <+60>: str x8, [x9, #0x10]
0x103aade50 <+64>: bl 0x103ad626c ; symbol stub for: swift_task_dealloc
0x103aade54 <+68>: ldr x8, [sp]
0x103aade58 <+72>: ldr x22, [x8, #0x10]
0x103aade5c <+76>: ldr x0, [x22, #0x8]
0x103aade60 <+80>: ldp x29, x30, [sp, #0x10]
0x103aade64 <+84>: and x29, x29, #0xefffffffffffffff
0x103aade68 <+88>: add sp, sp, #0x20
0x103aade6c <+92>: br x0
private func handleAppRefresh(task: BGAppRefreshTask) async {
Task {
let queue = OperationQueue()
scheduleAppRefresh() // breakpoint
print("test") // breakpoint
// Create an operation that performs the main part of the background task.
let operation = RefreshAppContentsOperation() // breakpoint
// Provide the background task with an expiration handler that cancels the operation.
task.expirationHandler = {
operation.cancel()
}
// Inform the system that the background task is complete
// when the operation completes.
operation.completionBlock = {
task.setTaskCompleted(success: !operation.isCancelled)
}
// Start the operation.
queue.addOperation(operation) // breakpoint
}
}
// Schedule a new refresh task.
func scheduleAppRefresh() {
let request = BGAppRefreshTaskRequest(identifier: "app.BackgroundTask")
// Fetch no earlier than 15 minutes from now.
request.earliestBeginDate = Date(timeIntervalSinceNow: 60)
print(request) // breakpoint
do {
try BGTaskScheduler.shared.submit(request)
} catch {
print("Could not schedule app refresh: \(error)")
}
}