react-native: RCTAppDelegate.h file not found

Description

I have updated my RN app from 0.70.6 to 0.71.4. The pod install working well. But when I’m trying to run the app it gave me the error saying RCTAppDelegate.h file not found. But I hadn’t problems with android running

React Native Version

0.71.4

Output of npx react-native info

System: OS: macOS 13.2.1 CPU: (10) arm64 Apple M1 Max Memory: 732.19 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.1 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.5.0 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.0 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.4 => 0.71.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

just need to run run ios

Snack, code example, screenshot, or link to a repository

Sorry it’s a private repo, and I can’t share the code with you

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 80 (14 by maintainers)

Most upvoted comments

For those who still have this issue, first make sure you opened “projectName”.xcworkspace and not “projectName”.xcodeproj in XCode.

I was getting this error. I had created a new target, and that target wasn’t in my Podfile. It disappeared after adding

target 'MyNewTarget' do
  inherit! :complete
end

within the larger target.

same issue 🥲 upgraded from 0.63.5 to 0.71.7,


Update : Found this for resolve the issue.


But facing another issue in “rn-fetch-blob”: “^0.12.0”,

ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:12:9 ‘React/RCTJSThread.h’ file not found This happed when I upgrade react native version from 0.63.5 to 0.71.7.

Screenshot 2023-05-19 at 12 56 16 PM

issues occurred in the following files

  • node_modules/rn-fetch-blob/ios/RNFetchBlobReqBuilder.m:11:
  • node_modules/rn-fetch-blob/ios/RNFetchBlobNetwork.h:14:
  • node_modules/rn-fetch-blob/ios/RNFetchBlobFS.h:12:
  • node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.h:17:

Is there any additional configurations that need to do or did I do any incorrect configuration. Any help on this.


Update : Found this for resolve the issue

npm install remove pod remove pod.lock reinstall the arch -x86_64 pod install --repo-update

Works for me.


I got it fixed by following a console warning when building with scratch configuration on my Podfile, Instead of adding use_frameworks! :linkage => :static (as suggested on react native firebase package docs) I added use_modular_headers! just above the target initialization line,

Hope this works for you too

If after trying all of the above and you are able to run on a real device, but not the simulator; try checking that the project, targets and pods build settings Excluded Architectures - Any iOS Simulator SDK are set to i386. My project build settings had it set to i386, but targets build settings had it set to arm64. I changed it to i386 for all and was able to run on a simulator.

Also you might have this in your Podfile if you are upgrading from an older react native project. This sets it back to arm64 after each pod install. Remove this as well.

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

I found the issue, it was connected with an m1 chip, on intel, and on a real device it works normally

Same issue on M1 “react”: “18.2.0”, “react-native”: “0.71.7”

I resolved it by opening the .xcworkspace file instead of the .xcodeproj. Then, the build was successful.

@DeveloperMCD please make sure of:

  1. Run USE_FRAMEWORKS=static bundle exec pod install to install the pods. Firebase requires that specific flag
  2. Open the xcworkspace file, not the xcodeproj file.

Thanks. Work in my case

Facing the same issue, Any Workaround is there yet? upgraded from 0.63 to 0.71.7, After that this issue is happening

yea I’m not sure what was the real problem, but deleting podfile.lock, pods, build and removing cache helped

I was able to fix this after a fair bit of pain.

I followed all the steps listed in Stack Overflow, google, chatGpt so…

rm -rf ios/Pods ios/Podfile.lock rm -rf ~/Library/Developer/Xcode/DerivedData

CRUCIALLY for me anyway, remember to add arm64 to excluded architectures in the build settings of the project and the Pods in Xcode image

image

And remember to re-add to Pods every time you delete them. I would have saved a lot of time after the first time I deleted those pods if I had have remembered that.

For those who still have this issue, first make sure you opened “projectName”.xcworkspace and not “projectName”.xcodeproj in XCode.

you saved my life 🤣

@DeveloperMCD please make sure of:

  1. Run USE_FRAMEWORKS=static bundle exec pod install to install the pods. Firebase requires that specific flag
  2. Open the xcworkspace file, not the xcodeproj file.

I was able to fixed this issue with by making sure use_frameworks! :linkage => :static was above use_react-native

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$RNFirebaseAsStaticFramework = true



platform :ios, min_ios_version_supported
deployment_target = '13.0'
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 'AppName' do
  config = use_native_modules!

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

  # This has to come before use_react_native or you get AppDelegate or RCTEventEmitter not found
  use_frameworks! :linkage => :static
  
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )


end

I added use_modular_headers! just above the target initialization line,

@callmesilva Is this use_modular_headers safe to use? Could it be away to get around the fact that use_frameworks is not supported on the new architecture?

For me its simply missing ‘arm64’ from Pods ‘Build settings’. After I install pod that Pod always missing that ‘arm64’ text Screenshot 2024-07-17 at 21 12 51

This is what you see when you install pod Screenshot 2024-07-17 at 21 04 00

Click on it and you can add it Screenshot 2024-07-17 at 21 04 19

Screenshot 2024-07-17 at 21 08 20

So this is how it should look like the ‘arm64’ should be in both place the the Debug and the Release Screenshot 2024-07-17 at 21 03 19

I hope this helps, sometimes very little things missing and ruin everything Oh and if you do that the first time you need to do that with the your project I mean above the ‘Pods’ it should be your project name and add the ‘arm64’ to your project ‘Build settings’ as well

I found my solution here: https://github.com/CocoaPods/CocoaPods/issues/9239#issuecomment-557579931 Hope it helps

In my case the same error was caused by cocoapods when I updated the version to 1.15.2 so, I installed the version 1.14.2, and I ran:

cd ios
npx po-install

and my problem was solved.

Thanks for clarifying @cipolleschi, that’s what I thought …

In the end, I could manage the error, tried different things and finally, it’s working again, I believe my error was in the Podfile because it wasn’t updated correctly. Also, I had a mix of different setups from other libraries that weren’t updated so had configs from different versions. I think one of the misconfigurations was causing the issue with the project compilation.

I’m not sure what the issue was, but I’ll suggest anybody having this problem, to check all your custom libraries and see if the configuration still applies to your current RN version.

Something to add is, the most important thing to verify is your Gemfile.lock file that effectively has:

DEPENDENCIES
  cocoapods (~> 1.12)

and before testing, remove from your root project, /vendor folder Gemfile.lock file and from ios folder, /Pods and Podfile.lock.

execute the bundle install and the pod install --repo-update (arch -x86_64 pod install --repo-update for M1/2 processors).

yea I’m not sure what was the real problem, but deleting podfile.lock, pods, build and removing cache helped

thanks for answering! unfortunately here no way to make it work, tried all that and still with problems 😭

I’m getting the same error – and I have a brand-new project with only TWO libraries: firebase and Vision Camera. Latest versions all around; this is a test app I’ve spent a while putting together.

React Native 0.73.4 Vision Camera 3.8.2 React Native Firebase Storage 18.8.0

@keshav-raj @Prathameshlabde @riyan10dec

Please, try the following steps:

  • Update to the most recent version of React Native (0.71.11).
  • Run yarn install in the root folder of your app
  • In the ios folder, run bundle install. This ensure that you have the right versions of Cocoapods and should make sure that cocopods works with both Intel and M1 chips
  • Reinstall your pods:
    • If you are using firebase, use USE_FRAMEWORKS=static bundle exec pod install
    • If you are not using firebase, use bundle exec pod install
  • Open your <app>.xcworkspace
  • Try to build and run the app

I hope these steps may help solving your issues.

“After five days of trying, I’m still encountering the same issue on M4, Xcode 16.3, and React Native 0.76.6, and I’ve had no luck.

i fixed my issue

fix(ios): Resolved ‘RCTAppDelegate.h’ not found by reverting to classic AppDelegate implementation

🛠 Issue: Build failed with: ‘RCTAppDelegate.h’ file not found This occurred because RCTAppDelegate is part of the new architecture, but our project explicitly uses: ENV[‘RCT_NEW_ARCH_ENABLED’] = “0”

🔧 Fix: Reverted to classic UIResponder-based AppDelegate class and added UIWindow property to ensure compatibility with non-Fabric architecture.

📄 Before: #import <RCTAppDelegate.h> #import <UIKit/UIKit.h> #import <UserNotifications/UserNotifications.h> #import <UserNotifications/UNUserNotificationCenter.h>

@interface AppDelegate : RCTAppDelegate <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate> @end

📄 After: #import <React/RCTBridgeDelegate.h> #import <UIKit/UIKit.h> #import <UserNotifications/UserNotifications.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate> @property (nonatomic, strong) UIWindow *window; @end

✅ Notes:

  • Retained UIKit and UserNotifications imports (these are not removed) as they’re required for push notification functionality.
  • This change ensures compatibility with React Native 0.76.6 with RCT_NEW_ARCH_ENABLED=0.

@Jeh212

Yes, the root cause is probably the same: one dependency that is not perfectly setup to work with use_frameworks! which is required by Firebase (or by another dependency). I’m going to systematically test the most common dependencies to look for failures. I already found one with react-native-gesture-handler (and opened a PR here: https://github.com/software-mansion/react-native-gesture-handler/pull/2635)

Looks like it was some import order problem. We also import another dependency in AppDelegate.h, called #import <UserNotifications/UNUserNotificationCenter.h>, which was imported before #import <RCTAppDelegate.h> (It’s from this repo: https://github.com/react-native-push-notification/ios.

After putting RCTAppDelegate.h to the very top, it started working again. Also I replaced React-RCTAppDelegate/RCTAppDelegate.h with just <RCTAppDelegate.h>, don’t know if this made any difference though.

Got the same issue as soon as I enable static linking. I did everything as described here but could not manage to make it build on iOS. Always get 'React-RCTAppDelegate/RCTAppDelegate.h' file not found. I’m on react native 0.72.4 btw.

What worked for me was, in ios/Podfile, add:

target 'YourTargetName' do
    inherit! :complete
  end

Seems like there’s an issue with XCode finding the location of RCTAppDelegate.h without it.

I Found Solution

This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)

Solution:

  • Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don’t have it yet.
  • Accept the Terms and Conditions.
  • Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
  • Point xcode-select to the Xcode app Developer directory using the following command:
  • sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Note: Make sure your Xcode app path is correct.

Xcode: /Applications/Xcode.app/Contents/Developer Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer

U can use command again npm install in ur project & Again pod install

Refer link StackOverFlow : https://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error

@cipolleschi thank you for reply. I was upgrading by changing files finding differences via upgrade-helper and somehow in my AppDelegate.h i was importing RCTAppDelegate.h as React/RCTAppDelegate.h 😉 Leaving just RCTAppDelegate.h helped to resolve the issue)

same issue. upgrading from 0.66.5 to 0.72.4

Me too, same issue! Although, I see React-RCTAppDelegate on Development Pods

Screenshot 2023-06-15 at 10 23 18

But still not found. Already do this https://github.com/facebook/react-native/issues/35818#issuecomment-1536291846, but still same issue.

I’m using https://github.com/invertase/react-native-firebase

    "@react-native-firebase/analytics": "^18.0.0",
    "@react-native-firebase/app": "^18.0.0",
    "@react-native-firebase/crashlytics": "^18.0.0",
    "@react-native-firebase/database": "^18.0.0",
    "@react-native-firebase/messaging": "^18.0.0",
    "@react-native-firebase/perf": "^18.0.0",

and my RN version is 0.71.8, i’m using M1 chip

I was able to fixed this issue with by making sure use_frameworks! :linkage => :static was above use_react-native

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$RNFirebaseAsStaticFramework = true



platform :ios, min_ios_version_supported
deployment_target = '13.0'
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 'AppName' do
  config = use_native_modules!

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

  # This has to come before use_react_native or you get AppDelegate or RCTEventEmitter not found
  use_frameworks! :linkage => :static
  
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )


end

I added use_modular_headers! just above the target initialization line,

@callmesilva Is this use_modular_headers safe to use? Could it be away to get around the fact that use_frameworks is not supported on the new architecture?

I tried the use_frameworks! :linkage => :static way but it was causing my app to miss the RCTAppDelegate.h file. Perhaps it is supported because it allowed me to install Firebase related pods, but somehow it was messing with the actual React Native package

same issue 🥲