当我运行flutter build ios时,我得到以下失败的输出:

Running pod install...                                             471ms
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      A firebase_dynamic_links
      A path_provider_ios
      A share_plus
      - Flutter
      - app_tracking_transparency
      - cloud_firestore
      - firebase_analytics
      - firebase_auth
      - firebase_core
      - google_sign_in_ios
      - purchases_flutter
      - shared_preferences_ios
      - sign_in_with_apple
      - url_launcher_ios

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `app_tracking_transparency` from `.symlinks/plugins/app_tracking_transparency/ios`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_analytics` from `.symlinks/plugins/firebase_analytics/ios`
    firebase_analytics: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
    firebase_auth: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_dynamic_links` from `.symlinks/plugins/firebase_dynamic_links/ios`
    firebase_dynamic_links: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `google_sign_in_ios` from `.symlinks/plugins/google_sign_in_ios/ios`
    -> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios`
    -> Fetching podspec for `purchases_flutter` from `.symlinks/plugins/purchases_flutter/ios`
    -> Fetching podspec for `share_plus` from `.symlinks/plugins/share_plus/ios`
    -> Fetching podspec for `shared_preferences_ios` from `.symlinks/plugins/shared_preferences_ios/ios`
    -> Fetching podspec for `sign_in_with_apple` from `.symlinks/plugins/sign_in_with_apple/ios`
    -> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/9.6.0/Firebase.podspec.json exists! Returning local because checking is only
      performed in repo update
      CDN: trunk Relative path: all_pods_versions_6_1_e.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/6/1/e/nanopb/2.30909.0/nanopb.podspec.json exists! Returning local because checking is only
      performed in repo update
      CDN: trunk Relative path: all_pods_versions_d_4_0.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/d/4/0/GoogleSignIn/6.2.4/GoogleSignIn.podspec.json exists! Returning local because checking is
      only performed in repo update
      CDN: trunk Relative path: all_pods_versions_9_a_d.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/9/a/d/PurchasesHybridCommon/4.3.1/PurchasesHybridCommon.podspec.json exists! Returning local
      because checking is only performed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/9.3.0/Firebase.podspec.json exists! Returning local because checking is only
      performed in repo update
    [!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
      In snapshot (Podfile.lock):
        Firebase/Firestore (= 9.3.0)

      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.0.5, which depends on
          Firebase/Firestore (= 10.1.0)

    Specs satisfying the `Firebase/Firestore (= 9.3.0), Firebase/Firestore (= 10.1.0)` dependency were found, but they required a
    higher minimum deployment target.

    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:257:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error running pod install

奇怪的是,我已经运行了几个星期的构建,没有任何问题.我不得不更新pubspec.yaml文件中的一些插件,然后在构建iOS时完全崩溃了

我立刻用谷歌搜索了我的答案,发现了这个堆栈溢出问题:Flutter Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified

他们提到:

您应该取消对您的个人资料iOS目标的注释.

我已经将其取消注释,并设置为platform :ios, '11.0'

然后我又做了一些研究,看起来可能是Mac M1芯片的问题:How to run CocoaPods on Apple Silicon (M1)

我在那里遵循了2022年的指示:

# Uninstall the local cocoapods gem
sudo gem uninstall cocoapods

# Reinstall cocoapods via Homebrew
brew install cocoapods

这次失败了,我想我掉进了一个更大的洞里,所以我跑了flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.5 21G72 darwin-arm, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[!] Xcode - develop for iOS and macOS (Xcode 14.1)
    ! CocoaPods 1.5.2 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart
        side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

然后我点击了链接,并按照说明更新了可可豆.

sudo gem install cocoapods
Fetching cocoapods-core-1.11.3.gem
Fetching cocoapods-1.11.3.gem
Successfully installed cocoapods-core-1.11.3
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-core-1.11.3
Installing ri documentation for cocoapods-core-1.11.3
Parsing documentation for cocoapods-1.11.3
Installing ri documentation for cocoapods-1.11.3
Done installing documentation for cocoapods-core, cocoapods after 2 seconds
2 gems installed

但如果我再次运行Flutter Flutter doctor ,它仍然说它过时了.

我觉得我现在处境更糟了.

推荐答案

在这里总结几个要点:

  1. 您的cocoapods安装已损坏.因此,请try 先通过"BREW卸载CocoaPods"删除BREW版本,然后通过sudo gem install cocoapods安装CocoaPods.

  2. 您的Podfile指的是同一个包的两个不同版本.

  [!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
      In snapshot (Podfile.lock):
        Firebase/Firestore (= 9.3.0)
 
      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.0.5, which depends on
          Firebase/Firestore (= 10.1.0)

这也可能导致生成错误.你可以试着找到不冲突的插件snapshotcloud_firestore的版本.

Ios相关问答推荐

为什么controlSize属性在SwiftUI中不起作用?

如何使用UICollectionView Compositionallayout在UIKit中正确渲染远程图像

PieChartView未以编程方式显示在屏幕上

SwiftUI拖动手势和内容拖动时的奇怪行为( skip /卡顿)

在 SwiftUI 中以编程方式插入内嵌图像

部分保留 UITextField 中的占位符

如何在 SwiftUI 中创建显示当前电池电量的电池徽章

Apollo iOS 客户端代码生成:错误:无法查询字段

在 SwiftUI 中使用 .rotation3DEffect 在视图之间翻转

SwiftUI 解除 .alert 弹出 NavigationView

如何在Collection 后更改并保留按钮 colored颜色 ,然后在 SwiftUI 中切换回来?

如何将单个按钮传递到自定义 ConfirmationDialog

try 在 iOS 中分发 Flutter 应用程序时出现Invalid Provisioning Profile Signature错误

如何在保持纵横比的同时zoom UIView 的内容以适应目标矩形?

光标未显示在 UITextView 中

Xcode 项目格式:3.1、3.2、6.3 和 8.0 有什么区别?

在 Swift 中追加字符串

iOS 7 圆形框架按钮

CoreBluetooth 应用程序到底能在后台做什么?

比较没有时间分量的 NSDates