Fix crash that could happen on launch because the background task wasn't registered before it was triggered
This commit is contained in:
parent
c21b235c6c
commit
99e2a44eed
|
@ -53,6 +53,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
super.init()
|
super.init()
|
||||||
appDelegate = self
|
appDelegate = self
|
||||||
|
|
||||||
|
registerBackgroundTasks()
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
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(accountRefreshDidFinish(_:)), name: .AccountRefreshDidFinish, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, 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 {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
|
|
||||||
registerBackgroundTasks()
|
|
||||||
|
|
||||||
AppDefaults.registerDefaults()
|
AppDefaults.registerDefaults()
|
||||||
let isFirstRun = AppDefaults.isFirstRun
|
let isFirstRun = AppDefaults.isFirstRun
|
||||||
if isFirstRun {
|
if isFirstRun {
|
||||||
|
|
Loading…
Reference in New Issue