Post

Replies

Boosts

Views

Activity

Reply to BGTaskScheduler registerForTaskWithIdentifier
Hey, thank you for your detailed help. I think that's my fail, I have a View-Extension "onFirstAppear" attached to my main-view which is only called once where I do the background-task registration. It is a SwiftUI App so i have no AppDelegate "didFinishlaunching..." so I thought this is a good place therefor. Is there a good place to do the registration in a SwiftuiApp? Do you have a recommendation where to do the registration in a SwiftUI-App? This is my code: var body: some Scene { WindowGroup { ContentView() ... `.onFirstAppear { BGTaskScheduler.shared.register(forTaskWithIdentifier: ID_APPREFRESH, using: nil) { task in handleAppRefresh(task: task as! BGAppRefreshTask) }` Thank you very much! 2023-04-20_10-34-48.7698_+0200-6240cc5ed317e999b76b0a68a2c9e4d8a595afb1.crash
Apr ’23