I have follow the doc until:
Availability in Build settings and Info.plist
step 6. create new build phase for the scheme which will generate "tmp.xcconfig" before each build exposing values to Build Settings and Info.plist (this snippet has to be placed after "echo ... > tmp/envfile" if approach explained below is used)
Has anyone ever faced it?
Happy to see any comments
@MRSEREY this comment helped me.
Also, be sure to clean your build before running and testing it.
@germanp173 thanks, but It still does not work.
in build settings -> packaging I change
I got an error build/GeneratedInfoPlistDotEnv.h not found
@MRSEREY sorry I should have been more clear and specified that the comment helped me by instructing me to remove those old settings which you just laid out (make sure you read the comment carefully). After I removed those Preprocessor flags and cleaned the project, it worked for me.
If you didn't have any of those old settings in place then:
${SRCROOT}/tmp.xcconfig after your build, do you see your environment variables there?@germanp173 it didn't see even tmp.xcconfig in ios folder
@germanp173 I can see tmp.xcconfig file now which contain my env there. But I still cannot access it in Info.plist.
I use this to access env $(MY_VAR)
hi @MRSEREY , do you resolve this issue? Thanks
@MRSEREY have you enabled "Provide build settings from
I ran into the same issue and fixed it by referencing the correct env variable name.
It used to be: __RN_CONFIG_XXX
Correct one: RNC_XXX
For more details, have a look at the generating script:
New way: https://github.com/luggit/react-native-config/blob/master/ios/ReactNativeConfig/BuildDotenvConfig.rb#L29
Old way: https://github.com/luggit/react-native-config/blob/v0.11.7/ios/ReactNativeConfig/BuildDotenvConfig.ruby#L69
I ran into the same issue and fixed it by referencing the correct env variable name.
It used to be: __RN_CONFIG_XXX
Correct one: RNC_XXXFor more details, have a look at the generating script:
New way: https://github.com/luggit/react-native-config/blob/master/ios/ReactNativeConfig/BuildDotenvConfig.rb#L29
Old way: https://github.com/luggit/react-native-config/blob/v0.11.7/ios/ReactNativeConfig/BuildDotenvConfig.ruby#L69
I was having the same issue. This worked for me Thanks!
For me, there were two problems:
If you have syntax errors in your .env file, the process fails without throwing any env-file-specific errors. In my case, I removed all comments and empty lines, and switched all double-quotes for single-quotes. Not sure which of these was the syntax error, but that fixed it.
Forgot to add Config.xcconfig to target membership.
Worked perfectly after that 馃憤
Most helpful comment
I ran into the same issue and fixed it by referencing the correct env variable name.
It used to be: __RN_CONFIG_XXX
Correct one: RNC_XXX
For more details, have a look at the generating script:
New way: https://github.com/luggit/react-native-config/blob/master/ios/ReactNativeConfig/BuildDotenvConfig.rb#L29
Old way: https://github.com/luggit/react-native-config/blob/v0.11.7/ios/ReactNativeConfig/BuildDotenvConfig.ruby#L69