Steps I followed.
1) yarn add react-native-config
2) Moved ReactNativeConfig.xcodeproj to Libraries
3) Added libReactNativeConfig.a to build phases.
4) Added echo ".env" > /tmp/envfile; in Scheme's build pre actions.
5) Added .env file with API_HOST=http://localhost:8080
6) Stated the project react-native run-ios --simulator='iPad Pro (11-inch) (12.2)' --configuration Debug
First I get GeneratedDotEnv.m not found error. After following the suggestions mentioned in other posts, when I rebuild the project, it started throwing duplicate symbol _OBJC_CLASS_$_ReactNativeConfig error in two place,
here
..Build/Products/Debug-iphonesimulator/react-native-config/libreact-native-config.a(ReactNativeConfig.o)
and here
../Build/Products/Debug-iphonesimulator/libReactNativeConfig.a(ReactNativeConfig.o)
Not sure why it happened, but running react-native unlink react-native-config made everything work again.
I'm getting this same error. Unlink is not working for me to fix it.
Unlinking react-native-config worked for me, thanks!!
Most helpful comment
I'm getting this same error. Unlink is not working for me to fix it.