首页 > 解决方案 > 未找到“GeneratedDotEnv.m”文件

问题描述

我正在创建一个 react native 应用程序,在其中我使用 react-native-config 来构建不同的版本。尝试存档项目时出现此错误。谁能帮我这个?

标签: iosxcodereact-native

解决方案


将以下post_install脚本添加到您的 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

请参考这个GitHub 问题


推荐阅读