CocoaPods 错误:添加共享扩展后无法找到对象版本“70”的兼容性版本字符串

问题描述 投票:0回答:1

将共享扩展添加到我的 Flutter iOS 项目后尝试运行 pod install 时,我收到此错误:

CopyArgumentError - [Xcodeproj] Unable to find compatibility version string for object version `70`.

环境:

  • CocoaPods:1.16.2
  • Xcode:16.1
  • macOS:15.0.1
  • 颤动项目

我的 Podfile:

rubyCopyENV['COCOAPODS_DISABLE_STATS'] = 'true'

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

platform :ios, '13.0'

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

target 'Share Extension' do
  use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

重现步骤:

  • 安装了 pod 的工作 Flutter iOS 项目
  • 在 Xcode 中添加了共享扩展目标
  • 向 Podfile 添加了共享扩展目标
  • 运行 pod install -> 发生错误

尝试过的事情:

  • 删除Pods/、Podfile.lock、Runner.xcworkspace
  • 不同的 Podfile 配置
  • pod 解体并重新安装
  • 删除并重新添加共享扩展
  • 降级 CocoaPods

该项目在没有共享扩展的情况下运行良好,我已将其删除并添加了多个图块。有什么想法如何解决这个问题吗?

ios flutter cocoapods share-extension
1个回答
0
投票

我在这里找到了答案:https://github.com/CocoaPods/CocoaPods/issues/12671#issuecomment-2445304215

添加扩展时,它会将您的 objectVersion 更改为 70,因此我需要将其更改回来

© www.soinside.com 2019 - 2024. All rights reserved.