From 33a1516121df8d8799319d127d901736af40d785 Mon Sep 17 00:00:00 2001 From: Alvaro Cuesta Date: Thu, 6 Jan 2022 17:41:15 -0300 Subject: [PATCH] fix crash app IOS --- .../notifications/RNFirebaseNotifications.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ios/RNFirebase/notifications/RNFirebaseNotifications.m b/ios/RNFirebase/notifications/RNFirebaseNotifications.m index d3aa1e3696..317a354402 100644 --- a/ios/RNFirebase/notifications/RNFirebaseNotifications.m +++ b/ios/RNFirebase/notifications/RNFirebaseNotifications.m @@ -105,12 +105,22 @@ - (void)didReceiveLocalNotification:(nonnull UILocalNotification *)localNotifica void (^fetchCompletionHandler)(UIBackgroundFetchResult) = fetchCompletionHandlers[handlerKey]; if (fetchCompletionHandler != nil) { fetchCompletionHandlers[handlerKey] = nil; - fetchCompletionHandler(fetchResult); + @try { + fetchCompletionHandler(fetchResult); + } + @catch (NSException * e) { + NSLog(@"Exception fetchCompletionHandler: %@", e); + }; } else { void(^completionHandler)(void) = completionHandlers[handlerKey]; if (completionHandler != nil) { completionHandlers[handlerKey] = nil; - completionHandler(); + @try { + completionHandler(); + } + @catch (NSException * e) { + NSLog(@"Exception completionHandler: %@", e); + }; } } }