diff --git a/native/ios/Comm/AppDelegate.mm b/native/ios/Comm/AppDelegate.mm --- a/native/ios/Comm/AppDelegate.mm +++ b/native/ios/Comm/AppDelegate.mm @@ -168,6 +168,7 @@ [self attemptDatabaseInitialization]; comm::ThreadOperations::updateSQLiteUnreadStatus(threadID, false); } + dispatch_semaphore_t rescind_complete_sem = dispatch_semaphore_create(0); [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^( NSArray *notifications) { @@ -180,8 +181,10 @@ removeDeliveredNotificationsWithIdentifiers:identifiers]; } } - completionHandler(UIBackgroundFetchResultNewData); + dispatch_semaphore_signal(rescind_complete_sem); }]; + dispatch_semaphore_wait(rescind_complete_sem, DISPATCH_TIME_FOREVER); + completionHandler(UIBackgroundFetchResultNewData); return YES; } return NO;