使用cached_network_image插件在iphone14模拟器上报错

来源:7-3 图片控件开发详解-1【技能储备】

水善一凡

2024-09-26

Launching lib/test/main.dart on iPhone 14 in debug mode...
Running pod install...
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

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

    Finding Podfile changes
      A sqflite
      - Flutter
      - image_picker_ios
      - path_provider_foundation
      - video_player_avfoundation

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `image_picker_ios` from `.symlinks/plugins/image_picker_ios/ios`
    -> Fetching podspec for `path_provider_foundation` from `.symlinks/plugins/path_provider_foundation/darwin`
    -> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/darwin`
    -> Fetching podspec for `video_player_avfoundation` from `.symlinks/plugins/video_player_avfoundation/darwin`

    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_4_2_c.txt exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: Specs/4/2/c/FlutterMacOS/3.16.0/FlutterMacOS.podspec.json exists! Returning local because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "sqflite":
      In Podfile:
        sqflite (from `.symlinks/plugins/sqflite/darwin`)

    Specs satisfying the `sqflite (from `.symlinks/plugins/sqflite/darwin`)` dependency were found, but they required a higher minimum deployment target.

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

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `11.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 14.

刚开始发现安装版本过高,但是换了低的版本也不行

写回答

1回答

CrazyCodeBoy

2024-09-28

在 Flutter 项目中遇到 CocoaPods 相关的错误,特别是关于 sqflite 的兼容性问题,通常与最低 iOS 部署目标有关。以下是解决此问题的步骤:

解决步骤

1. 指定 iOS 部署目标: 打开项目中的 ios/Podfile 文件,并在文件的顶部找到 platform :ios, '9.0' 或 platform :ios, '11.0' 这一行。将其更新为更高的版本,例如 12.0 或 13.0(具体版本可根据 sqflite 的要求选择):

platform :ios, '12.0'  # 或 '13.0'


2. 更新 CocoaPods: 在终端中运行以下命令来确保 CocoaPods 是最新版本:

sudo gem install cocoapods


3. 清理并重建项目: 运行以下命令以清理 Flutter 项目并重新构建:

flutter clean
flutter pub get


4. 重新安装 Pods: 进入 iOS 文件夹并重新安装 Pods:

cd ios
pod install


5. 再次运行 Flutter 应用: 返回项目根目录并再次尝试运行应用:

cd ..
flutter run



其他注意事项

确保 Xcode 和所有相关工具都是最新的。

如果依然遇到问题,可以尝试删除 ios/Pods 文件夹和 Podfile.lock 文件,然后再次运行 pod install。

确认所有使用的插件(如 sqflite)的文档,确保没有其他版本的要求。


以上步骤应能帮助你解决 CocoaPods 在 flutter run 时卡住的问题。如果仍有问题,请提供具体的错误信息。

0
0

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3270 问题

查看课程