diff --git a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m index e92939af53..660b16fc5a 100644 --- a/packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m +++ b/packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m @@ -163,9 +163,9 @@ - (void)application:(UIApplication *)application // If app is in background state, register background task to guarantee async queues aren't // frozen. sharedInstance.backgroundTaskId = [application beginBackgroundTaskWithExpirationHandler:^{ - if (backgroundTaskId != UIBackgroundTaskInvalid) { - [application endBackgroundTask:backgroundTaskId]; - backgroundTaskId = UIBackgroundTaskInvalid; + if (sharedInstance.backgroundTaskId != UIBackgroundTaskInvalid) { + [application endBackgroundTask:sharedInstance.backgroundTaskId]; + sharedInstance.backgroundTaskId = UIBackgroundTaskInvalid; } }]; @@ -246,4 +246,4 @@ - (void)application:(UIApplication *)application } } -@end \ No newline at end of file +@end