|
|
@@ -43,8 +43,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
|
|
|
|
|
|
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
|
|
+ NSLog(":BACKGROUND:LOG: Start bg sync...")
|
|
|
Sync()
|
|
|
- completionHandler(UIBackgroundFetchResult.newData)
|
|
|
+
|
|
|
+ let when = DispatchTime.now() + 120 // 2 minutes to perform the sync.
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: when) {
|
|
|
+ NSLog(":BACKGROUND:LOG: Calling completion handler.")
|
|
|
+ completionHandler(UIBackgroundFetchResult.newData)
|
|
|
+ }
|
|
|
+
|
|
|
/*if let tabBarController = window?.rootViewController as? UITabBarController, let viewControllers = tabBarController.viewControllers {
|
|
|
for viewController in viewControllers {
|
|
|
if let fetchViewController = viewController as? FetchViewController {
|