Flutter 项目。升级到 XCode 15.0.1 `pod install` 后抛出错误 ParserError of FlutterMacOS.podspec.json 3.13.2

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

我已经升级了 XCode 和 MacOS,现在我的 Flutter 项目(与 XCode 一样)无法工作。 Pod 有一些问题,但我不明白

详情

命令

/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>'

扑医生

Doctor 摘要(要查看所有详细信息,请运行 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 list --local | grep cocoapods  
    然后`gem uninstall
  • 我尝试重新加载我的Mac
  • 我尝试了
    flutter clean
    +
    flutter pub get
    ->
    pod install
  • 的所有组合
  • 我用旧的
    pubspec.yaml
    创建了一个新项目,之后它在
    pod 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/

我想制作一个

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

ios flutter xcode cocoa cocoapods
1个回答
0
投票

TLDR;

  1. 尝试更新flutter
  2. 尝试使用 此说明
  3. 更新可可

我解决了我的问题...我不知道

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

FlutterMacOS
)。

自从出现错误后,我已将 Flutter 更新到 3.13.9,将 cocoa 更新到 1.13.4(原来是 1.13.3)

也许删除

Runner.xcworkspace
也有帮助,因为在更新 cocoa
Flutter
后,我按照
这些说明
做了所有事情之后 - 一切都工作正常。

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