From ecb9c582e62fc2d9b97ae6adc6241a36f0517a37 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 46b800cce9d..31b888911aa 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -81,11 +81,6 @@ [_window makeKeyAndVisible]; } -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // Noop -} - - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"