This is a nice review by Chuck Krutsinger.
I am trying to implement the background fetch functionality but it does not work. Following the code example, I set the app capabilities, then add to my AppDelegate:
- register the task ID in didFinishLaunching
- add the refresh stub, and the scheduleAppRefresh to the AppDelegate
the BGTaskScheduler.shared.register(forTaskWithIdentifier:
runs, but the handler never does. Neither do either of the refresh methods.
The Tutorial has one add
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
to AppMain.swift BUT, the tutorial is for Swift 5.5, not SwiftUI, and this should not be needed since obviously I have direct access to the AppDelegate in straight Swift.
Is there anything to try to help get this sample code running?