"No matching function for call to 'RCTAppSetupPrepareApp'" and "No matching function for call to 'RCTAppSetupDefaultRootView'" errors when building project in Xcode
Description
I am unable to build my project due to the "No matching function for call to 'RCTAppSetupPrepareApp'" and "No matching function for call to 'RCTAppSetupDefaultRootView'" errors.
I'd be grateful for any help to resolve this issue.
React Native Version
0.71.2
Output of npx react-native info
System: OS: macOS 13.2.1 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 104.64 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.11.0 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm Watchman: 2022.10.31.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/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: Not Found Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 13.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.2 => 0.71.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Steps to reproduce:
- create bare react native project
- add libraries to use with Husky and Lint-staged for pre-commit hooks
- install react-native-navigation
My package.json:
{ "name": "bookcase", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "format": "prettier --write .", "lint": "eslint --ext .js,.jsx,.ts,.tsx --fix", "start": "react-native start", "test": "jest" }, "lint-staged": { "*.{js,jsx,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@react-navigation/bottom-tabs": "^6.5.5", "@react-navigation/drawer": "^6.6.0", "@react-navigation/material-bottom-tabs": "^6.2.13", "@react-navigation/material-top-tabs": "^6.6.0", "@react-navigation/native": "^6.1.4", "@react-navigation/native-stack": "^6.9.10", "react": "18.2.0", "react-native": "0.71.2", "react-native-gesture-handler": "^2.9.0", "react-native-pager-view": "^6.1.4", "react-native-paper": "^5.2.0", "react-native-reanimated": "^2.14.4", "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.20.0", "react-native-tab-view": "^3.5.0", "react-native-vector-icons": "^9.2.0" }, "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", "@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/parser": "^5.51.0", "babel-jest": "^29.2.1", "eslint": "^8.33.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-native-a11y": "^3.3.0", "husky": "^8.0.3", "jest": "^29.2.1", "lint-staged": "^13.1.1", "metro-react-native-babel-preset": "0.73.7", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "jest": { "preset": "react-native" } }
Snack, code example, screenshot, or link to a repository
Link to my repository:
https://gitlab.com/MagdaFronczyk/bookcase
| :warning: | Newer Version of React Native is Available! |
|---|---|
| :information_source: | You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
You probably need to manually replace some files. I suspect you upgraded react native recently. If that's the case take a look at this: https://react-native-community.github.io/upgrade-helper/?from=0.70.7&to=0.71.3 and replace the files manually after that it should work again
This Worked !! change the lines as per below for this issue:

File: AppDelegate.mm
Before:
RCTAppSetupPrepareApp(application);
After:
RCTAppSetupPrepareApp(application, true);
Before:
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"Mobile", initProps);
After:
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"Onboarding", initProps, true);
I am also having issues with this and the proposed fix did not work for me.
The line in where the rootView pointer is initialized looks like this:
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps];
Not how it is described.
Update: Running expo prebuild fixed all the issues. I did have to bring back some files like certificates, storekit configs, etc. But Expo updated all these files to the way they are supposed to be written in the newer version.
@AAlvarez90 Can you please mention what changes expo prebuild did. Which line expo prebuild added instead of UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps];
I am also having issues with this and the proposed fix did not work for me. The line in where the
rootViewpointer is initialized looks like this:UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps];Not how it is described.Update: Running expo prebuild fixed all the issues. I did have to bring back some files like certificates, storekit configs, etc. But Expo updated all these files to the way they are supposed to be written in the newer version.
@AAlvarez90 please I'm having the same problem as @balkrushnag . Could you tell us please what change in RootViewline?
@elenitaex5 After running expo prebuild the entire line got removed from AppDelegate.mm
@elenitaex5 can you replace the function didFinishLaunchingWithOptions with the following mentioned here
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
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 = @{};
[super application:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}
It worked for me, and fyi RN version is 0.71.7.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.