react-native-config: Configuration of bundle id in Info.plist not working

When using variables in Info.plist, the bundle id doesn’t get updated. However, the display name updates as expected. Do you know why?

.env

DISPLAY_NAME=MyApp
BUNDLE_ID=com.mycompany.myapp

Info.plist:

<key>CFBundleDisplayName</key>
<string>__RN_CONFIG_DISPLAY_NAME</string>
<key>CFBundleIdentifier</key>
<string>__RN_CONFIG_BUNDLE_ID</string>

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 7
  • Comments: 25

Most upvoted comments

@SoundBlaster It works! I Just follow these steps below:

  1. Go to your project -> Build Settings -> All
  2. Search for “preprocess”
  3. Set Preprocess Info.plist File to Yes
  4. Set Info.plist Preprocessor Prefix File to ${BUILD_DIR}/GeneratedInfoPlistDotEnv.h
  5. Set Info.plist Other Preprocessor Flags to -traditional

having the same issue, app name showing as __RN_CONFIG_DISPLAY_NAME

@luongs3 I just test __RN_CONFIG_BUNDLE_ID and it works. In the Info.plist:

<key>CFBundleIdentifier</key>
<string>__RN_CONFIG_BUNDLE_ID</string>

and in the .env.alpha:

BUNDLE_ID=com.valamismobile.alpha

I followed instruction

Did anyone resolve this problem?

My solution was with a combination of Fastlane actions: mainly update_app_identifier, update_project_provisioning and match.

Also added fastlane_require 'dotenv' at the start of the Fastlane file, so I could load the dov env vars with Dotenv.load("../../.env.development").

It seems to work for me but it also appears to only work when I clean my build folder between switching environments which isn’t ideal.

@jenskuhrjorgensen I was having the same problem, It looks like code signing with Xcode uses the value from the original Info.plist to “Check dependencies” before signing, and it uses it without the pre-processing step. I solved it using fastlane as @grifotv mentioned. However, if you want to archive from Xcode you’ll have to manually write your PRODUCT_BUNDLE_IDENTIFIER before archiving.

@danilValeev this works for me unitl I try to upload to app store. Every visible field states the correct app identifier. dev builds also work as expected.

Though the automatically signing says there is an error with my entitlements. Once I change the bundle identifier manually, everything works like a charm. Did you try the app store upload?

@MelonDeng But I still have a problems with Automatically Signing in Xcode. It creates a new provisioning profile and etc. for BundleID “__RN_CONFIG_BUNDLE_ID”. So, I need to manually fix it in GUI. So sad.