From adaceba5462b4ad8676745f34e0be2bf5bb25166 Mon Sep 17 00:00:00 2001 From: Alex Toudic Date: Tue, 24 Dec 2024 06:56:55 -0800 Subject: [PATCH] Fix applicationDidEnterBackground not being called (#48376) Summary: I noticed that `AppDelegate` subscribers listening for `applicationDidEnterBackground` events in Expo projects (as documented [here](https://github.com/expo/expo/blob/238b6f57e459dd2c0b13ee158f0af709fe922460/docs/pages/modules/appdelegate-subscribers.mdx?plain=1#L56) aren't working as expected anymore. While investigating, I discovered that the events aren't reaching the `ExpoAppDelegate` implementation ([source](https://github.com/expo/expo/blob/71f2c55ff3f11e43ab43761bb5cece2e48eae0bf/packages/expo-modules-core/ios/AppDelegates/ExpoAppDelegate.swift#L61)) because the `RCTAppDelegate` implementation of `applicationDidEnterBackground` interrupts the event chain. This appears to be affecting some legitimate use cases. I believe we could improve this by removing the current implementation, but I'd love to hear your thoughts on this approach. I might be missing some context about why this implementation was originally needed, so any insights would be greatly appreciated! ## Changelog: [IOS] [FIXED] - Fix applicationDidEnterBackground not being called Pull Request resolved: https://github.com/facebook/react-native/pull/48376 Test Plan: Ran a local test after change Reviewed By: javache Differential Revision: D67621557 Pulled By: cipolleschi fbshipit-source-id: 2d73711372deba867bd616c79ef4d00c79aa86d5 --- .../react-native/Libraries/AppDelegate/RCTAppDelegate.mm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index e00c1d5fa2f..42e17ad9fda 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -84,11 +84,6 @@ using namespace facebook::react; [_window makeKeyAndVisible]; } -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // Noop -} - - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"