This commit is contained in:
anlicheng 2025-07-29 18:12:58 +08:00
parent b0c89d9998
commit f071002cc3

View File

@ -103,7 +103,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
BGTaskScheduler.shared.register(forTaskWithIdentifier: taskId, using: nil) { task in BGTaskScheduler.shared.register(forTaskWithIdentifier: taskId, using: nil) { task in
self.handleAppRefresh(task: task as! BGAppRefreshTask) self.handleAppRefresh(task: task)
} }
Task.detached { Task.detached {
@ -132,7 +132,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return true return true
} }
private func handleAppRefresh(task: BGAppRefreshTask) { private func handleAppRefresh(task: BGTask) {
self.scheduleAppRefresh() self.scheduleAppRefresh()
task.expirationHandler = { task.expirationHandler = {