Reputation: 570
I'm creating a react native app in which I use react-native-config for building different versions. I'm getting this error when trying to archive the project. Can anyone help me with this?
Upvotes: 3
Views: 9060
Reputation: 161
I put pod 'react-native-config', :path => '../node_modules/react-native-config'
inside Podfile
...
target 'app' do
...
pod 'react-native-config', :path => '../node_modules/react-native-config'
...
end
And this works for me.
My versions:
"react": "18.1.0"
"react-native": "0.70.4",
"react-native-config": "1.4.4"
I downgrade react-native-config
from 1.4.11
to 1.4.4
Upvotes: 2
Reputation: 21
Add below post_install
script to your podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
targets_to_ignore = %w(React)
if targets_to_ignore.include? target.name
target.remove_from_project
end
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
Please Refer this GitHub-Issue
Upvotes: 2
Reputation: 13926
Refer to this link and you'll be able to fix it.
or I recommend applying this method.
Using RN 0.53.0.
Basically the process is to:
add the ../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj to your own project
In your Target settings, Build Phases, Link Binary With Libraries, add libReactNativeConfig.a.
Manage scheme, expand "Build", click "Pre-actions", "New Run Script Action", enter:
if [ "${ENVFILE}" ]; then echo "${ENVFILE}" > /tmp/envfile ; else echo ".env" > /tmp/envfile; fi
Ensure your .env.prod file has some key/values without spaces around the = like I've been seeing around these threads. Then run in term: $ ENVFILE=.env.prod react-native run-ios.
Please refer to this link for more details.
Upvotes: 1