浏览代码

Merge pull request #1222 from deltachat/always-end-bg

make sure, pending backgroundTask is ended before recreated
bjoern 4 年之前
父节点
当前提交
d76ea19e0d
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      deltachat-ios/AppDelegate.swift

+ 1 - 0
deltachat-ios/AppDelegate.swift

@@ -178,6 +178,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     private func registerBackgroundTask() {
     private func registerBackgroundTask() {
         logger.info("⬅️ registering background task")
         logger.info("⬅️ registering background task")
         bgIoTimestamp = Double(Date().timeIntervalSince1970)
         bgIoTimestamp = Double(Date().timeIntervalSince1970)
+        unregisterBackgroundTask()
         backgroundTask = UIApplication.shared.beginBackgroundTask { [weak self] in
         backgroundTask = UIApplication.shared.beginBackgroundTask { [weak self] in
             // usually, the background thread is finished before in maybeStop()
             // usually, the background thread is finished before in maybeStop()
             logger.info("⬅️ background expirationHandler called")
             logger.info("⬅️ background expirationHandler called")