React-native-config: react-native 0.60 Preprocessing failure

Created on 4 Jul 2019  路  11Comments  路  Source: luggit/react-native-config

Most helpful comment

Add this post install script in the Podfile (at the end)

post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-config'
        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
        phase.shell_script = "cd ../../"\
                             " && RNC_ROOT=./node_modules/react-native-config/"\
                             " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

        target.build_phases << phase
        target.build_phases.move(phase,0)
      end
    end
  end

and do pod install.

Now try to build.

All 11 comments

Add this post install script in the Podfile (at the end)

post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-config'
        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
        phase.shell_script = "cd ../../"\
                             " && RNC_ROOT=./node_modules/react-native-config/"\
                             " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

        target.build_phases << phase
        target.build_phases.move(phase,0)
      end
    end
  end

and do pod install.

Now try to build.

@roshangm1 Do you know how to read env values in info.plist ? Which npm version of react-native-config are you using.

@roshangm1 Your fix works well for "building" but it doesn't work when I am doing "archive". Any idea ?

@roshangm1 I experience the same as @tgensol, do you have any fix for archiving?

Actually I was not using the GeneratedInfoPlist file and feature from react-native-config, so I simply removed it in my build settings, and it is working just fine now. (By the way, I cannot find in the Readme the setup part for the GeneratedInfoPlist, so it was maybe an old feature that does not exist anymore ? )

Any progress on this? 馃槃

I also removed my GeneratedInfoPlist file from my build settings because I did not need it. This seems like the only fix right now

Any progress on this? [2] 馃槃

I modified script a little bit.

post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-config'
        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
        phase.shell_script = "cd ../../"\
                             " && RNC_ROOT=./node_modules/react-native-config/"\
                             " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"

        target.build_phases << phase
        target.build_phases.move(phase,0)
      end
    end
  end

Custom pod install script? 馃 Do I really need a .env in my mobile app?

any good forks that solve this issue?

Was this page helpful?
0 / 5 - 0 ratings