From 99e2a44eed61c4d980a2c5606a4f6ffbe688a273 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 14 Aug 2019 19:48:18 -0500 Subject: [PATCH] Fix crash that could happen on launch because the background task wasn't registered before it was triggered --- iOS/AppDelegate.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 673d3e665..1b3cc44db 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -53,6 +53,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele super.init() appDelegate = self + registerBackgroundTasks() + NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(accountRefreshDidFinish(_:)), name: .AccountRefreshDidFinish, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) @@ -64,8 +66,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - registerBackgroundTasks() - AppDefaults.registerDefaults() let isFirstRun = AppDefaults.isFirstRun if isFirstRun {