IOS-1628 (TMP) Log the issue. IOS-1628
authorDirk Zimmermann <dz@pep.security>
Fri, 07 Jun 2019 16:33:04 +0200
branchIOS-1628
changeset 896716624ad559fb
parent 8964 003cec7ad513
child 8969 e90c044aaccb
IOS-1628 (TMP) Log the issue.
pEpForiOS/AppDelegate.swift
     1.1 --- a/pEpForiOS/AppDelegate.swift	Fri Jun 07 13:50:53 2019 +0200
     1.2 +++ b/pEpForiOS/AppDelegate.swift	Fri Jun 07 16:33:04 2019 +0200
     1.3 @@ -7,6 +7,7 @@
     1.4  //
     1.5  
     1.6  import CoreData
     1.7 +import os.log
     1.8  
     1.9  import pEpIOSToolbox
    1.10  import MessageModel
    1.11 @@ -47,6 +48,8 @@
    1.12  
    1.13      let notifyHandshakeDelegate: PEPNotifyHandshakeDelegate = NotifyHandshakeDelegate()
    1.14  
    1.15 +    private let osLog = OSLog(subsystem: "AppDelegate", category: "pEp.security.app")
    1.16 +
    1.17      func applicationDirectory() -> URL? {
    1.18          let fm = FileManager.default
    1.19          let dirs = fm.urls(for: .libraryDirectory, in: .userDomainMask)
    1.20 @@ -87,6 +90,10 @@
    1.21      private func stopUsingPepSession() {
    1.22          syncUserActionsAndCleanupbackgroundTaskId =
    1.23              application.beginBackgroundTask(expirationHandler: { [unowned self] in
    1.24 +                os_log("expirationHandler syncUserActionsAndCleanupbackgroundTaskId %d",
    1.25 +                       log: self.osLog,
    1.26 +                       type: .error,
    1.27 +                       self.syncUserActionsAndCleanupbackgroundTaskId.rawValue)
    1.28                  Log.shared.errorAndCrash(
    1.29                      "syncUserActionsAndCleanupbackgroundTask with ID %{public}@ expired",
    1.30                      self.syncUserActionsAndCleanupbackgroundTaskId as CVarArg)
    1.31 @@ -95,6 +102,11 @@
    1.32                  self.application.endBackgroundTask(UIBackgroundTaskIdentifier(
    1.33                      rawValue: self.syncUserActionsAndCleanupbackgroundTaskId.rawValue))
    1.34              })
    1.35 +        os_log("started syncUserActionsAndCleanupbackgroundTaskId %d",
    1.36 +               log: osLog,
    1.37 +               type: .default,
    1.38 +               self.syncUserActionsAndCleanupbackgroundTaskId.rawValue)
    1.39 +
    1.40          messageModelService?.processAllUserActionsAndStop()
    1.41      }
    1.42  
    1.43 @@ -380,6 +392,12 @@
    1.44              // No problem, start regular sync loop.
    1.45              startServices()
    1.46          }
    1.47 +
    1.48 +        os_log("ending syncUserActionsAndCleanupbackgroundTaskId %d",
    1.49 +               log: osLog,
    1.50 +               type: .default,
    1.51 +               self.syncUserActionsAndCleanupbackgroundTaskId.rawValue)
    1.52 +
    1.53          application.endBackgroundTask(UIBackgroundTaskIdentifier(rawValue: syncUserActionsAndCleanupbackgroundTaskId.rawValue))
    1.54          syncUserActionsAndCleanupbackgroundTaskId = UIBackgroundTaskIdentifier.invalid
    1.55      }