Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeneratedInfoPlistDotEnv.h file not found and iOS command not working #216

Open
wswebcreation opened this issue Jan 18, 2018 · 15 comments
Open

Comments

@wswebcreation
Copy link

@pedro

First of all tnx for this great module. I do have some questions remarks about it.

Config:

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 found

When 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 #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:

  • downgrading react-native
  • executing react-native link
  • upgrading to latest version of react-native

I solved the first problem

ENVFILE=.env.prod react-native run-ios not working

According 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 #131 where I've added my solution.

Question

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

@fareskalaboud
Copy link

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.

Assumptions:

  • You're using React Native version 0.51.0
  • You're using react-native-config 0.11.5

To fix:

  • Open ios/app.xcodeproj/project.pbxproj
  • Open the "Find & Replace" tool of your preferred text editor
  • Replace all instances of ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h with this instead: ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h

Also 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

@gyss
Copy link

gyss commented Jul 16, 2018

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

@prathammehta
Copy link

Same problem here
react-native: 0.51.0

@pdoggi
Copy link

pdoggi commented Jul 18, 2018

@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!

@gyss
Copy link

gyss commented Jul 18, 2018

@pdoggi since this repo looks like is no longer maintained I'm going to go with my own solution. It's safer for now.

@mathew3
Copy link

mathew3 commented Sep 23, 2018

@pdoggi thanks! Manual linking worked (first 2 steps), didn't need to modify ios/app.xcodeproj/project.pbxproj

@mcanobbio
Copy link

with
"react-native": "0.57.4"
"react-native-config": "^0.11.7"

works the solution from @pdoggi thanks!

@benseitz
Copy link

Manual Linking was the only described solution, that worked for me :)

@chancyWu
Copy link

Manual Linking worked

@ghost
Copy link

ghost commented Oct 9, 2019

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.

  1. yarn add https://github.com/luggit/react-native-config.git

  2. 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.

@raldred
Copy link

raldred commented Dec 4, 2019

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

@lancesnider
Copy link

@raldred's solution worked right up until I upgraded to react-native-config 0.12.0. Has anyone had success with this version?

@raldred
Copy link

raldred commented Dec 7, 2019

@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.

@lancesnider
Copy link

@raldred I have, yes.

@abo-rythm
Copy link

@raldred I have, yes.

May you give us some details about the steps done? I can't figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests