Reputation: 83
After updating the RN version from 0.70.6 to 0.71.4 ios pod install working, but the app doesn't build and gives an error. 'RCTAppDelegate.h' file not found any ideas??
I have tried all steps in react-native-update-helper(android works)
Updated
I don't have AppDelegate.mm so i did all changes in AppDelegate.m
Upvotes: 6
Views: 34598
Reputation: 350
I got this issue within React Native project when cloned main target, created "abstract_target" in Podfile, and forgot to run
pod install
after :)
Upvotes: 0
Reputation: 1
Adding use_frameworks! :linkage => :static
before use_react_native!
in Podfile
use_frameworks! :linkage => :static
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
and excluding 1368 for both debug and release instead of arm64 worked for me.
Upvotes: 0
Reputation: 231
My issue was that I didn't have the arm architectures specifically listed in my build settings.
More specifically, in Xcode, navigate to Targets
>"Your app"
>Build Settings
>Architectures
Here, $(ARCHS_STANDARD)
will already be listed by default. Add armv7
, arm64
, and x84_64
(this one may not be necessary) to the list.
Then clean the build folder (CMD+SHFT+K) and run pod deintegrate
followed by pod install
to clean install your pods.
Good luck
Upvotes: 0
Reputation: 99
I was able to fix this by deleting ios/build folder and reinstalling the dependencies. But I am not sure what caused this.
Upvotes: 0
Reputation: 129
Issue:
I had started building the app on Windows and testing on Android. I wanted to test on iOS as well, so I moved the code to my Intel Mac running Monterey.
After following the React Native Environment setup guide, I stumbled upon this error when trying to build my app:
fatal error: 'RCTAppDelegate.h' file not found
#import <RCTAppDelegate.h>
After hours of troubleshooting, I found that my Podfile in the project\ios folder was always generated empty.
> pod init
> pod install
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
I tried creating a new ReactNative project with:
> npx react-native init TestProject
And it worked and built the app without any errors.
Steps I ended up doing:
Downgrading Ruby:
> brew install rbenv ruby-build
> rbenv install 2.7.6
> eval "$(rbenv init - zsh)"
Creating a new ReactNative project to test if everything is working smoothly
> npx react-native init TestProject
I noticed the pod --version
command showed 1.8.3, even though I had a newer version installed. After uninstalling it using sudo gem uninstall cocoapods
, it still showed the same version. I had to uninstall all traces of Pod with this command:
> which pod
> sudo rm -rf <path>
Copied the Podfile contents of the TestProject to my main project and ran:
> pod install
App built without any errors.
Upvotes: 5
Reputation: 3248
Make sure you opened "projectName".xcworkspace and not "projectName".xcodeproj in XCode.
Upvotes: 19
Reputation: 244
If you're using use_frameworks! :linkage => :static
it has to come before 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 # if you're using firebase
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
Also I am on Mac M1, and I am not excluding arm64. In my Project -> Target -> Exclude Architectures, I am only excluding i386 for both Debug and Release. Excluding arm64 caused issues with finding certain files as well. I hope something works!
Another well known issue is if you're also using react-native-splash-screens it will cause your iOS entrypoint to hang for 0.71.0 and greater. Update your AppDelegate.mm like so
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure]; // If you're using react-native firebase
self.moduleName = @"main";
// 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 = @{};
bool didFinish = [super application:application didFinishLaunchingWithOptions:launchOptions];
[RNSplashScreen show]; // this needs to be called after [super application:application didFinishLaunchingWithOptions:launchOptions];
return didFinish;
}
for android the builds were fine, but if you still want to open the splash screen follow the installation instructions and add import org.devio.rn.splashscreen.SplashScreen;
to the import statements, then add this to the bottom of MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(null); // to ensure android is compatible with react-native-screens
}
} // This is the final closing bracket of public class MainActivity extends ReactActivity {
Upvotes: 10
Reputation: 11
Try to remove Pods
and build
folders and Podfile.lock
file, then re-install pods.
Upvotes: 0
Reputation: 421
Delete the node_modules folder, along with package-lock.json
then run npm cache clean --force
and the reinstall using npm install
if you are using yard, basicly the same thing, rm yarn.lock, yarn cache clean and then yarn install
Upvotes: 0