Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] RCTAppDelegate.h file not found #7627

Closed
2 of 7 tasks
Thijmen opened this issue Feb 15, 2024 · 6 comments
Closed
2 of 7 tasks

[🐛] RCTAppDelegate.h file not found #7627

Thijmen opened this issue Feb 15, 2024 · 6 comments
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report

Comments

@Thijmen
Copy link

Thijmen commented Feb 15, 2024

Issue

Hi there, in a clean app (created as such; npx react-native@latest init AwesomeProject) and following the steps for iOS linking, I am getting the following error after building the project in Xcode;
image

My Podfile is provided below.

The pod install command ran without any issues.


Project File

package.json:

{
  "name": "AwesomeProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-firebase/app": "^18.8.0",
    "react": "18.2.0",
    "react-native": "0.71.8"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.1",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.73.9",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "jest": {
    "preset": "react-native"
  }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'AwesomeProject' do
  config = use_native_modules!

  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true


  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    #:flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'AwesomeProjectTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

AppDelegate.m:

#import "AppDelegate.h"
#import <Firebase.h>


#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  self.moduleName = @"AwesomeProject";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  [FIRApp configure];

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
  return true;
}

@end

Environment

Click To Expand

react-native info output:

❯ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 93.77 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v21.1.0/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v19.3.0/bin/npm
    Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.14.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK:
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: Not Found
    Xcode: 15.0/15A240d - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.8.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.8 => 0.71.8 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


@Thijmen Thijmen added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Feb 15, 2024
@Thijmen
Copy link
Author

Thijmen commented Feb 15, 2024

Not sure if this is related to ARM (M1) or not, though.

@Thijmen
Copy link
Author

Thijmen commented Feb 15, 2024

For some reason it does build now, not sure what changed. Closing for now.

@Thijmen Thijmen closed this as completed Feb 15, 2024
@Stas-Buzunko
Copy link
Contributor

The same issue occurs with a clean project using https://github.com/react-native-community/reproducer-react-native and React Native v0.76.1. It builds fine unless I add use_frameworks! :linkage => :static (even without installing any React Native Firebase library).

The result is "RCTAppDelegate.h file not found."

@mikehardy
Copy link
Collaborator

And yet, this fully automated starts-from-scratch build failure reproducer I have for react-native-firebase works - https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

Somewhere, somehow, a step is missing. A read of the script I just linked might show what step, since it performs each step programmatically from react-native init through a build

@Stas-Buzunko
Copy link
Contributor

Forgot to add that our main project repo used to work fine on macOS 14 and Xcode 15. It got broken after the update to macOS 15 and Xcode 16, using ARM (M1) as well.

I will be testing your script shortly.

@Stas-Buzunko
Copy link
Contributor

@mikehardy Thanks, the demo you provided builds successfully (I only had to add

target.build_configurations.each do |config|
  config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
end

to run it on the simulator).

I noticed it uses the latest CocoaPods. I'm going to try to update them. I haven't noticed any other differences so far except for using Yarn instead of npm, but I guess it shouldn't affect anything.

I will be comparing other things after updating CocoaPods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report
Projects
None yet
Development

No branches or pull requests

3 participants