Skip to content

Conversation

@Srishtyshree
Copy link

feat: Implement UIScene lifecycle for iOS

Summary

This PR implements UIScene lifecycle support for React Native on iOS, resolving the warning: CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle. This will become an assert in a future version.

Fixes #54739

Problem

Starting with iOS 13, Apple introduced the UIScene lifecycle to support multi-window applications and better separate UI concerns from application-level concerns. React Native's RCTAppDelegate currently doesn't support this modern lifecycle, causing a warning that Apple has indicated will eventually become an assertion (app crash) in future iOS versions.

Solution

This PR adds UIScene lifecycle support to RCTAppDelegate while maintaining backward compatibility:

Changes Made

1. Modified RCTAppDelegate.h

  • Added application:configurationForConnectingSceneSession:options: method declaration
  • Method is marked with API_AVAILABLE(ios(13.0)) for backward compatibility

2. Modified RCTAppDelegate.mm

  • Implemented UIScene configuration method
  • Returns a UISceneConfiguration that specifies RCTSceneDelegate as the scene delegate class

3. Created RCTSceneDelegate.h

  • New scene delegate class conforming to UIWindowSceneDelegate
  • Marked with API_AVAILABLE(ios(13.0))
  • Manages the window property for the scene

4. Created RCTSceneDelegate.mm

  • Implements UIScene lifecycle methods:
    • scene:willConnectToSession:options: - Sets up the window and React Native root view
    • sceneDidDisconnect: - Handles scene disconnection
    • sceneDidBecomeActive: - Scene activation handling
    • sceneWillResignActive: - Scene deactivation handling
    • sceneWillEnterForeground: - Foreground transition
    • sceneDidEnterBackground: - Background transition
  • Integrates with existing RCTAppDelegate to access RCTReactNativeFactory and RCTRootViewFactory

5. Updated RNTester/Info.plist

  • Added UIApplicationSceneManifest configuration
  • Demonstrates proper UIScene setup for React Native apps

Key Design Decisions

  1. Backward Compatibility: All UIScene-related code is guarded with API_AVAILABLE(ios(13.0)), ensuring apps targeting iOS < 13 continue to work.

  2. Opt-in Approach: UIScene support is activated only when apps include the UIApplicationSceneManifest in their Info.plist. Existing apps without this configuration continue using the traditional app delegate lifecycle.

  3. Integration with Existing Architecture: The RCTSceneDelegate accesses the app delegate to retrieve the RCTReactNativeFactory, maintaining consistency with the existing React Native initialization flow.

  4. No Breaking Changes: Existing apps using RCTAppDelegate without UIScene configuration will continue to work exactly as before.

Testing

Manual Testing Performed

  1. RNTester with UIScene: Built and ran RNTester with UIScene manifest - app launches successfully, no warnings
  2. Backward Compatibility: Verified that removing UIScene manifest still works (traditional lifecycle)
  3. Scene Lifecycle Events: Tested app backgrounding, foregrounding, and scene transitions

Expected Behavior

Before this PR:

  • Warning in Xcode console: CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle

After this PR:

  • No warning when UIApplicationSceneManifest is present in Info.plist
  • App properly adopts UIScene lifecycle on iOS 13+
  • Existing apps without UIScene manifest continue working as before

Migration Guide for Users

For New Apps

Include the following in your Info.plist:

<key>UIApplicationSceneManifest</key>
<dict>
    <key>UIApplicationSupportsMultipleScenes</key>
    <false/>
    <key>UISceneConfigurations</key>
    <dict>
        <key>UIWindowSceneSessionRoleApplication</key>
        <array>
            <dict>
                <key>UISceneConfigurationName</key>
                <string>Default Configuration</string>
                <key>UISceneDelegateClassName</key>
                <string>RCTSceneDelegate</string>
            </dict>
        </array>
    </dict>
</dict>

For Existing Apps

Option 1: Adopt UIScene (Recommended for iOS 13+)

  • Add the UIApplicationSceneManifest configuration above to your Info.plist
  • No code changes required if using RCTAppDelegate

Option 2: Continue with Traditional Lifecycle

  • No changes needed
  • App will continue working as before
  • Warning will persist but can be ignored for now

Changelog

[iOS] [Added] - Implement UIScene lifecycle support for iOS 13+

Additional Notes

  • The RCTAppDelegate class is marked as deprecated in favor of RCTReactNativeFactory, but this PR adds UIScene support to maintain compatibility for existing users
  • The podspec (React-RCTAppDelegate.podspec) automatically includes new .h and .mm files via podspec_sources, so no podspec changes were needed
  • All UIScene APIs are properly guarded with availability checks

Screenshots

UIScene lifecycle adopted successfully - no warnings in Xcode console


Reviewers: @cipolleschi @huntie @cortinico

Please let me know if you'd like any changes to this implementation or if you prefer a different approach!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 3, 2025
@react-native-bot
Copy link
Collaborator

Fails
🚫

📋 Missing Changelog - Please add a Changelog to your PR description. See Changelog format

Warnings
⚠️ 📋 Missing Test Plan - Can you add a Test Plan? To do so, add a "## Test Plan" section to your PR description. A Test Plan lets us know how these changes were tested.

Generated by 🚫 dangerJS against c42884f

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle. This will become an assert in a future version.

4 participants