When running Archive in XCode 14.2 of react native code we run into this error in AppDelegate file.
No matching function for call to ‘RCTAppSetupPrepareApp’
I am using react native 0.71.7, react-native-cli: 2.0.1, and node 18.13.0
The code was supposed to be archived, but doesnt.
3
Answers
I was facing same error so I checked the actual version of react and previous I had when it worked last time. According to react-native upgrade helper, I see that this piece of code has changed and is no longer there. Check if this is not the case for you too.
https://react-native-community.github.io/upgrade-helper/?from=0.70.6&to=0.71.2
I’ve fixed the issue with the following changes:
File:
AppDelegate.mm
Before:
After:
Before:
After:
Thanks to
dimitardanailov
who answered in herechange RCTAppSetupPrepareApp(application);
TO
RCTAppSetupPrepareApp(application,true);
And
*change UIView rootView = RCTAppSetupDefaultRootView(bridge, @"attendance", initProps)
TO
*UIView rootView = RCTAppSetupDefaultRootView(bridge, @"attendance", initProps,true);
And
you might be need to clean the project after follow these steps