@pedro
First of all tnx for this great module. I do have some questions remarks about it.
OS: OSX 10.13.2 (17C88)
XCODE: 9.2 (9C40b)
react-native: 0.51
react-native-config: 0.11.5
When I follow the instructions in the readme I get everything working for Android but not for iOS
GeneratedInfoPlistDotEnv.h file not foundWhen I follow the instructions for iOS in the readme I get the first error, which is GeneratedInfoPlistDotEnv.h file not found.
I've read the issue list and saw more people have this issue, see https://github.com/luggit/react-native-config/issues/83. I finally found a solution in issue 125 where they say the problem lies in the react-native link command that works differently between react-native 0.49.3 and 0.50.0.
By:
react-nativereact-native linkreact-nativeI solved the first problem
ENVFILE=.env.prod react-native run-ios not workingAccording to the docs I should be able to use ENVFILE=.env.prod react-native run-ios but because we _hardcoded_ the command echo ".env" > /tmp/envfile I can't pass any other value. I then found a solution in issue https://github.com/luggit/react-native-config/issues/131 where I've added my solution.
Are both really issues, or am I doing something wrong. If they are I can create a PR for you to update the docs with these steps.
Like to hear from you
So, I was able to fix this without actually downgrading.
This assumes you've followed the iOS Setup instructions to the dot at the time of me writing this.
ios/app.xcodeproj/project.pbxproj${BUILD_DIR}/GeneratedInfoPlistDotEnv.h with this instead: ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.hAlso make sure your .env file doesn't define environment variables with any spaces:
e.g.
FOOD='pizza' // this is good
FOOD = 'pizza' // this is bad
I'm having the same problem
Config:
OS: OSX 10.13.5
XCODE: 9.4.1
react-native: 0.55.4
react-native-config: 0.11.5
But in my case, neither ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h nor ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h is solving the problem
Same problem here
react-native: 0.51.0
@gyss , @prathammehta Manual linking did it for me. I'm also using ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h, not sure if that helps or not. I'm on react-native 0.55.4, react-native-config 0.11.5. Good luck!
@pdoggi since this repo looks like is no longer maintained I'm going to go with my own solution. It's safer for now.
@pdoggi thanks! Manual linking worked (first 2 steps), didn't need to modify ios/app.xcodeproj/project.pbxproj
with
"react-native": "0.57.4"
"react-native-config": "^0.11.7"
works the solution from @pdoggi thanks!
Manual Linking was the only described solution, that worked for me :)
Manual Linking worked
If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author haven't released auto-linking support on NPM yet, even though it's already merged!?
Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.
yarn add https://github.com/luggit/react-native-config.git
cd ios && pod install
You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.
You can still use 0.11.7 with RN 0.60
Setting Preprocessor Prefix File to:
${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/GeneratedInfoPlistDotEnv.h
Fixed this for me with RN 0.60 and xcode 11.2.1
@raldred's solution worked right up until I upgraded to react-native-config 0.12.0. Has anyone had success with this version?
@lancesnider have you tried following the readme with 0.12? I think the maintainers have change the way it works, I haven't looked at 0.12 myself yet.
@raldred I have, yes.
@raldred I have, yes.
May you give us some details about the steps done? I can't figure it out.
Most helpful comment
@pdoggi thanks! Manual linking worked (first 2 steps), didn't need to modify
ios/app.xcodeproj/project.pbxproj