项目“Pods”已损坏,无法打开。检查项目文件是否存在无效编辑或未解决的源代码管理冲突

The project ‘Pods’ is damaged and cannot be opened. Examine the project file for invalid edits or unresolved source control conflicts

安装 pod 后我的“pods”无法被 Xcode 识别并导致我的构建失败。

这是我尝试从 Pods/Pods.xcodeproj:

打开 pods 时收到的消息

项目“Pods”已损坏,无法打开。检查项目文件是否存在无效编辑或未解决的源代码管理冲突。

这是我的播客文件:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false


target 'applicationTemplate' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  # Pods for applicationTemplate
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'react-native-webview', :path => '../node_modules/react-native-webview'
  pod 'react-native-voice', :path => '../node_modules/react-native-voice'
  pod 'react-native-torch', :path => '../node_modules/react-native-torch'
  pod 'RNKeychain', :path => '../node_modules/react-native-keychain'
  
  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  pod 'RNOpenAppSettings', :path => '../node_modules/react-native-app-settings'

  target 'applicationTemplateTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'applicationTemplate-tvOS' do
  # Pods for applicationTemplate-tvOS

  target 'applicationTemplate-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

# App Tracking Transparency https://rnfirebase.io/analytics/usage#disable-ad-id-usage-on-ios
$RNFirebaseAnalyticsWithoutAdIdSupport = true

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
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
 end

我是这样解决问题的:

只需删除此行:install! 'cocoapods', :deterministic_uuids => false 和 运行 pod deintegrate && pod cache clean --all && pod install

我添加它是因为我正在使用 react-native 升级助手,我在他们的 podfile 中看到他们是这一行,所以我添加了它,但显然它不适用于每次升级,所以要小心升级助手。