React Native launch troubleshooting in a legacy versions
June 27, 20202 min readreact-native
Photo by: Ashkan Forouzani
This memo will be useful for those who faced issues with running react native < 0.59v on macOS mojave. I have been struggled with running RN 0.55. During the week I was trying to run the app, I have been solving each issue step by step when all the issues had been done I decided to write a small memo to collect all problems that I had in one place.
The first thing you should use legacy build system for your app.
-
Open XCODE
file > workspace settings -> build system: legacy build system
-
Try to run:
react-native run-ios
The issues that I had during the launch **RN 0.55** using **_Xcode 11_** and mac os **_mojave_** are described below:
1. Could not find iPhone 6 simulator.
-
Run:
xcrun simctl list devices
- Check available simulators
-
Run:
react-native run-ios --simulator 'SIMULATOR_NAME'
2. Success build but simulator crash after launch.
Open node_modules/react-native/React/Base/RCTModuleMethod.mm
.
Replace RCTParseUnused
method to
static BOOL RCTParseUnused(const char **input)
{
return RCTReadString(input, "__attribute__((unused))") ||
RCTReadString(input, "__attribute__((__unused__))") ||
RCTReadString(input, "__unused");
}
3. Build error: ‘React/RCTImageLoaderProtocol.h’ file not found.
Replace
#import <React/RCTImageLoaderProtocol.h>
to
#import <React/RCTImageLoader.h>
4.Xcode build fails to download third-party dependencies.
1.
rm -rf node_modules/ && yarn cache clean && yarn install and rm -rf ~/.rncache
2.
cd node_modules/react-native/scripts
3.
./ios-install-third-party.sh
If your network is slow, you can download the packages separately and move them to the rncache folder
- folly-2016.10.31.00
- double-conversion-1.1.5
- glog-0.3.5
- boost163_0
cd <Your-Project-Folder>/node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
I hope it was useful for you, many thanks.