From a05fb481e0c659f96926df6ea61f74953d0b16c8 Mon Sep 17 00:00:00 2001 From: Thilo Molitor Date: Thu, 9 Jan 2025 23:41:39 +0100 Subject: [PATCH] Fix crash on bootup termination --- Monal/Classes/MonalAppDelegate.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Monal/Classes/MonalAppDelegate.m b/Monal/Classes/MonalAppDelegate.m index b702e581c..af1b2737f 100644 --- a/Monal/Classes/MonalAppDelegate.m +++ b/Monal/Classes/MonalAppDelegate.m @@ -325,6 +325,11 @@ -(id) init _shutdownPending = NO; _wasFrozen = NO; + //register BGTasks as early as possible to make sure a subsequent app termination + //without proper "bootup" won't crash on unknown bgtask identifiers + DDLogInfo(@"calling MonalAppDelegate configureBackgroundTasks"); + [self configureBackgroundTasks]; + //[self runParserTests]; //[self runSDPTests]; //[HelperTools flushLogsWithTimeout:0.250]; @@ -538,10 +543,6 @@ -(BOOL) application:(UIApplication*) application didFinishLaunchingWithOptions:( //handle message notifications by initializing the MLNotificationManager [MLNotificationManager sharedInstance]; - //register BGTask - DDLogInfo(@"calling MonalAppDelegate configureBackgroundTasks"); - [self configureBackgroundTasks]; - // Play audio even if phone is in silent mode [HelperTools configureDefaultAudioSession]; self.audioState = MLAudioStateNormal;