Flutter 项目。升级到 XCode 15.0.1 后,“pod install”抛出错误 FlutterMacOS.podspec.json 3.13.2 的 ParserError

Flutter project. After upgrade to XCode 15.0.1 `pod install` throw error ParserError of FlutterMacOS.podspec.json 3.13.2

提问人:Dmitrii Proshutinskii 提问时间:10/26/2023 更新时间:10/29/2023 访问量:121

问:

我已经升级了 XCode 和 MacOS,现在我的 Flutter 项目(一如既往地在 XCode 的情况下)不起作用。豆荚有一些问题,但我不明白

命令

/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod install

报告

  • 你做了什么?

  • 你期望会发生什么?

  • 发生了什么?

   CocoaPods : 1.13.0
        Ruby : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
    RubyGems : 3.4.10
        Host : macOS 14.0 (23A344)
       Xcode : 15.0.1 (15A507)
         Git : git version 2.39.3 (Apple Git-145)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.2_1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

插件

cocoapods-clean       : 0.0.1
cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile 文件

# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

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}. Try deleting Generated.xcconfig, then run flutter pub get"
end

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

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

错误

JSON::ParserError - Failed to parse JSON at file: '/Users/koptehe/.cocoapods/repos/trunk/Specs/4/2/c/FlutterMacOS/3.13.2/FlutterMacOS.podspec.json'.

unexpected token at ''
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification.rb:752:in `from_string'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification.rb:726:in `from_file'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source.rb:188:in `specification'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:58:in `block in specification_name'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:56:in `each'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:56:in `specification_name'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/cdn_source.rb:216:in `search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:165:in `search_for'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `each'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_by!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:94:in `resolve'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:422:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:162:in `install!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
/Users/koptehe/.gem/ruby/2.7.2/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `<main>'

颤振医生

医生摘要(要查看所有详细信息,请运行 flutter doctor -v):

[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.1)
[✓] Connected device (2 available)
[✓] Network resources

其他信息

  • 我试着做,但无济于事rm -rf ~/.cocoapods/repos/trunk
  • 我尝试删除所有 cocoapods 并重新安装(然后'gem uninstallgem list --local | grep cocoapods
  • 我尝试重新加载我的 Mac
  • 我尝试了所有组合flutter clean + flutter pub get -> pod install
  • 我用旧的创建了一个新项目,之后它会抛出错误pubspec.yamlpod install

pubspec.yaml

name: unknown_app
description: Unknown app
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  bloc: ^8.1.2
  bloc_concurrency: ^0.2.2
  equatable: ^2.0.5
  firebase_core: ^2.20.0
  intl: 0.18.1
  formz: ^0.6.0
  cupertino_icons: ^1.0.6
  flutter_bloc: ^8.1.3
  url_launcher: ^6.1.11
  flutter_svg: ^2.0.7
  geolocator: ^10.1.0
  google_maps_flutter: ^2.5.0
  google_maps_cluster_manager: ^3.0.0+1
  flutter_native_timezone: ^2.0.0
  http: ^1.1.0
  webview_flutter: ^4.4.1
  mask_text_input_formatter: ^2.4.0
  image_picker: ^1.0.4
  firebase_messaging: ^14.7.2
  flutter_local_notifications: ^16.1.0
  sentry_flutter: ^7.11.0
  in_app_review: ^2.0.6
  package_info_plus: ^4.0.2
  flutter_secure_storage: ^9.0.0
  rive: ^0.12.1
  async: ^2.11.0
  

dev_dependencies:
  bloc_test: ^9.1.3
  mocktail: ^0.3.0
  very_good_analysis: ^5.0.0+1
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true
  generate: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/icons/

我想在 iOS 上制作并运行我的应用程序。pod install

iOS Flutter Xcode 可可 Cocoapods

评论


答:

0赞 Dmitrii Proshutinskii 10/29/2023 #1

顶级域名;

  1. 尝试更新 flutter
  2. 尝试按照以下说明更新可可

我用...我不知道

发生了什么事?据我了解,cocoa 在 Flutter 3.13.6 下没有文件(特别是)。FlutterMacOS

自从错误发生以来,我已将 Flutter 更新到 3.13.9,将 cocoa 更新到 1.13.4(原为 1.13.3)

而且删除也可能有帮助,因为在我按照这些说明完成所有操作后,更新后 - 一切正常。Runner.xcworkspacecocoaFlutter