WKExtension.scheduleBackgroundRefresh 什么时候应该调用预定的完成处理程序?
When WKExtension.scheduleBackgroundRefresh is supposed to call scheduledCompletion handler?
我正在尝试使用以下行安排后台任务:
WKExtension.shared().scheduleBackgroundRefresh(withPreferredDate: Date(timeIntervalSinceNow: TimeInterval(5) * 60), userInfo: nil, scheduledCompletion: self.scheduledCompletion)
哪里
func scheduledCompletion(error: Error?) {
if error == nil { print("successfully scheduled application background refresh") }
else { print("error scheduling background refresh, error: \(error)") }
}
scheduledCompletion
A block that is called by the system after the
background app refresh task has completed.
但由于未知原因,它在计划 后台刷新任务后被直接调用。后台刷新任务在正确的时间被调用,但是 scheduledCompletion
之后没有被调用。
这是文档错误、WatchKit 错误还是我做错了什么?
尽管有文档的描述,scheduledCompletion
将是安排任务的时间。它在 WWDC16 Keeping Your Watch App Up to Date session 11:23:
期间被提及
我正在尝试使用以下行安排后台任务:
WKExtension.shared().scheduleBackgroundRefresh(withPreferredDate: Date(timeIntervalSinceNow: TimeInterval(5) * 60), userInfo: nil, scheduledCompletion: self.scheduledCompletion)
哪里
func scheduledCompletion(error: Error?) {
if error == nil { print("successfully scheduled application background refresh") }
else { print("error scheduling background refresh, error: \(error)") }
}
scheduledCompletion
A block that is called by the system after the background app refresh task has completed.
但由于未知原因,它在计划 后台刷新任务后被直接调用。后台刷新任务在正确的时间被调用,但是 scheduledCompletion
之后没有被调用。
这是文档错误、WatchKit 错误还是我做错了什么?
尽管有文档的描述,scheduledCompletion
将是安排任务的时间。它在 WWDC16 Keeping Your Watch App Up to Date session 11:23: