-
Notifications
You must be signed in to change notification settings - Fork 660
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
iOS Integration change - clarification #413
Comments
it didn't work for my in the latest release, |
Hmm, it didn't work using the old mechanism or doesn't work with the new? |
I agree it'd be helpful if the project maintainer would include an example of accessing values in the documentation. I am also unable to get access within |
I was able to get access within
Hopefully this is helps others with issues. |
Many thanks @dcalhoun - will try this tomorrow. |
With some help from this post, I now have data in my tmp.xcconfig |
@c0d3x if you are referring to accessing environment variables from |
So why does it not work? I have the basic setup too. |
@c0d3x I cannot answer that question from the information you provided. I recommend opening a new issue in this repository outlining the details of your setup and potentially creating a simple reproduction example of your issue in a public repository. That will help the community assist you. |
Allready did: #412 |
Looks Like
is now the method of accessing env vars from .env |
I tried the new approach and tried to follow the advice exactly, but ran into problems like this
So am still stuck on the old mechanism with __RN_CONFIG_xxx references, which DOES still seem to work though I haven't had confirmation yet whether this is reliable. |
For me the following worked for RN 61.4 and RNC 12.0:
|
I've done the steps but it doesn't work. RN Config: 0.12.0 |
@damathryx whats the errors? does your info plist use $() instead now? |
I have the BuildXCConfig.rb building the tmp.xcconfig. What am I missing? Based on the Readme everything is in the same order. |
Found it. |
same for me, please help |
To automate build phase addition you can add the following code snippet to your
Don't forget to clear project cache and install pods after addition. |
for me i have multiple schemes so I set the "envfile" echo ".env.dev" > /tmp/envfile then I toggled the build system from new to legacy and back also moved the "${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildXCConfig.rb" "${SRCROOT}/.." "${SRCROOT}/tmp.xcconfig" to a build phase. |
@maxkomarychev , could you kindly help out with how the new scheme works? I have looked at the project's README. I've also looked at the sample project, using the
Should it be added as a Target build phase (e.g. "Run Script"), or as a Pre-Action in the Scheme settings?
I've tried lots of combinations of the above, and have had zero luck getting it to work. For others trying to debug this, note that you may have to take extra steps for XCode to re-build the Info.plist file, as shown here, otherwise you may make changes to it and not be reflected in the compiled app. |
hey @twelve17 ,
hope this helps! |
@maxkomarychev yes, thank you so much for your response! I can confirm I have gotten it to work using those instructions, but will add I had to remove the cached Info.plist, which I did by adding a command to do so in the same pre-action:
Reference: https://stackoverflow.com/a/18638003 |
@maxkomarychev I've noticed that for production builds I've created via the XCode "Archive" task, the app is not seeing the configs. Is it possible that the same pre-action and "provide build settings" (2 and 3 from my comment) are needed in the scheme's "Archive" section too? Or is there another step necessary? |
@twelve17 looks like you're right, it needs to be as Pre-Action for Archive too. |
@maxkomarychev that didn't seem to fix my problem. I think I'm running into #409 . The circle build is always ending up with a Info.plist file that is missing the env values. After spending so many hours on this, I think I will need to either do this workaround or downgrade to the version of this module prior to this approach change. |
Agree! The README did not mention that I need to change the key:
Follow README file and use $(KEY) form will work |
hey, if you still having issues with this lib - I kindly ask to try my - https://www.npmjs.com/package/react-native-ultimate-config |
I'm experiencing this issue, it seems to only be happening when I build via command line. In xcode it's working fine. That sounds plausible as some of you are reporting CI issues which are headless. Maybe something to do with the SRCROOT path being different from terminal? But that shouldn't happen |
Thanks, @maxkomarychev! It works like a charm 🎉 🎉 🎉 |
I solved the issue by making sure "Provide build settings from" had the target set - before it was blank. Edit: derp I see @Thram above commented the same! Don't know how I missed that 🤦♂️ @maxkomarychev I checked out your library, the README is excellent and looks really thorough. Just wondering if it supports multiple environment files? In our project we have 8 different env files and I couldn't see a way to choose a specific one apart from maybe overwriting |
@nabilfreeman the lib does not have any path hardcoded - just explicitly specify file you want to use when running cli. Feel free to open issues with questions in my repo. Thanks for feedback! |
As for me I just run right after It works locally and on CI as well. Moreover, If you use TypeScript you got a fully typed config object in JS.
|
@ArekChr You don't need configuration.
|
this does not work, works only in info.plist |
Any update for this one? |
In this commit you changed the way ios integration is managed, but can you clarify whether the old mechanism still works? I have Info.plist entries like this:
And this in build settings, as per the old instructions:
And, at least in releases to TestFairy this still seems to work having upgraded to react-native-config 0.11.7, but before we roll out to the app store I just wanted confirmation that this will still work.
Were there any upgrade instructions when this new mechanism was rolled out? What is the advantage of the new mechanism using a .xcconfig file? Seems more complicated in the setup to me, and the latest README does not clarify how to refer to ENVFILE variables in the Info.plist file.
The text was updated successfully, but these errors were encountered: