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

Does the 0.12 version support autolink? #414

Closed
MaxInMoon opened this issue Nov 26, 2019 · 17 comments
Closed

Does the 0.12 version support autolink? #414

MaxInMoon opened this issue Nov 26, 2019 · 17 comments

Comments

@MaxInMoon
Copy link

I'm wondering if 0.12 version support autolink cause:

First

In the readme there is:

Link the library:

$ react-native link react-native-config

But autolink should not need a link command, right?

Secondly

With these versions:

"react-native": "0.61.5",
"react-native-config": "^0.12.0",

I have an error on iOS:

built-in>:1:10: fatal error: '/Users/{USERNAME}/Library/Developer/Xcode/DerivedData/XXX-fdoedqtrcjsbppgvncqzfwelgcim/Build/Products/GeneratedInfoPlistDotEnv.h' file not found
#include "/Users/{USERNAME}/Library/Developer/Xcode/DerivedData/XXX-fdoedqtrcjsbppgvncqzfwelgcim/Build/Products/GeneratedInfoPlistDotEnv.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Command Preprocess failed with a nonzero exit code

See #187 (comment)

@pedrodurek
Copy link

Same problem here

@jishuke
Copy link

jishuke commented Nov 27, 2019

I have the same issue, and haven't been able to find a workaround.

@vvusts
Copy link

vvusts commented Nov 27, 2019

I also tried everything from referenced thread and can’t pass this error on RN60.6

@vvusts
Copy link

vvusts commented Nov 27, 2019

Just a small idea for those that need speed like me.
I downgraded module to "0.11.7" and linked in xcode I passed this error for now.
Also:
In this file react-native.config.js on prject root it is required to add this to preven autolinking for this module on IOS (delete pod lock and pod folder as well and then pod update, pod install).

module.exports = {
  dependencies: {
    'react-native-config': {
      platforms: {
        ios: null
      }
    }
  }
}

@Dimon70007
Copy link

@vvusts thank you very much for this workaround.
It really works for me ([email protected] + [email protected] and manual linking with react-native-config project in xcode)
In Edit scheme I have added React to Build Targets before main Project also.
rnconfig linking

@lapto
Copy link

lapto commented Dec 10, 2019

Auto linking worked for me but I had to clean up the old settings:

Open the iOS dir in Xcode.
Select the main file ***.xcodeproj
Select "Build settings"
Search for Preprocessor
On the field "Info.plist Other preprocessor Flags" delete the value : "-traditional"
On the field "Info.plist Preprocessor Prefix File" delete the value : "build/GeneratedInfoPlistDotEnv.h"
On The field "Preprocess Info.plist file" change the value to "No" 

@jitendralakhmani-proptiger

@lapto which version of react-native-config did you use ?

@lapto
Copy link

lapto commented Dec 10, 2019

@jitendralakhmani-proptiger

"react-native": "0.61.5"
"react-native-config": "0.12.0"

@jitendralakhmani-proptiger

@lapto Did you add any post install script in your podfile?

@lapto
Copy link

lapto commented Dec 10, 2019

@jitendralakhmani-proptiger
No script in build phase or anything in schemes. The package isn't listed in my Podfile either as autolink manages to find it from node_modules.

I do have the extra steps described in readme for the android build tho

@charkcl
Copy link

charkcl commented Dec 27, 2019

@MaxInMoon I managed to autolink with v0.12. Using it with fastlane, I have written up my approach here and repo.

@grifotv
Copy link

grifotv commented Jan 13, 2020

I downgraded module to "0.11.7" and linked in xcode I passed this error for now.

@vvusts @Dimon70007 what were the steps to link it "manually" in Xcode?

@Dimon70007
Copy link

@grifotv for manual linking
1 - you should unlink library from xcode - react-native unlink react-native-config, add to react-native.config.js file this code:

module.exports = {
  dependencies: {
    'react-native-config': {
      platforms: {
        ios: null, // disable autolinking react-native-config for ios
      },
    },
  },
};

and run cd ios && rm -rf Pods && pod install; cd ../
2 - you should manually link react-native-config library to your project in xcode - see https://facebook.github.io/react-native/docs/0.59/linking-libraries-ios#manual-linking

@grifotv
Copy link

grifotv commented Jan 15, 2020

thanks @Dimon70007

I did like you said, but instead of manually linking I used npx react-native link react-native-config following these steps #187 (comment)

@luatnd
Copy link

luatnd commented Mar 11, 2020

I tried! It work with auto linking:

"react-native": "0.61.5",
"react-native-config": "0.12.0",

It also work for ios Info.plist. The README did not mention that I need to change the key:

Within Info.plist, you now must access the values in your .env files with $() (e.g. $(MY_KEY_NAME)) rather than _RN_CONFIG.

Follow README file and use $(KEY) form will work

@luancurti
Copy link
Collaborator

Please use 1.0.0 it's fixed in this version

@arnaudambro
Copy link

What do you mean "fixed in this version" ? A simple yarn add react-native-config and that's all ?

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