.backgroundTask in SwiftUI cannot compile

Error Code: error build: Command CompileSwift failed with a nonzero exit code

My Code:

.backgroundTask(.appRefresh("checkValidity")) {
//   scheduleAppRefresh()
//  checkRecords()
}

AFAIK this is a compile-time only error, and thus it should work on iOS 16.0. However, I wouldn’t take my word for this. You need to test what you ship.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I also have the same problem. May I ask what the solution is? BackgroundTask still cannot run in blank projects

@main
struct TestApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.backgroundTask(.appRefresh("task")) {
await update()
}
}
func update() async{
print("ran background")
}
}
.backgroundTask in SwiftUI cannot compile
 
 
Q