为了将数据上传到Firestore DB,我应该在我的应用程序中运行后台线程。
应用程序将在后台或终止,即使用户已关闭应用程序,我仍需要将信息上传到服务器
这段代码似乎要执行Thread,但是它应该放在哪里呢?我能把它放到我的applicationDidEnterBackground或applicationWillTerminate里吗?
DispatchQueue.background(background: {
let checkPointWorker = CheckPointWorker()
checkPointWorker.writeCheckPointsToFirestore()
}, completion:{
// Background job finished
})
https://stackoverflow.com/questions/56246016
复制相似问题