iOS 18与Xcode 16环境下Flutter应用构建失败求助
iOS 18 + Xcode 16环境下Flutter应用pod install失败问题
问题描述
在iOS 18和Xcode 16环境构建Flutter应用时,执行pod install失败,核心错误如下:
关键错误提示
[!] 路径
/Users/abdullahghanayem/StudioProjects/menatracks/ios/.symlinks/plugins/flutter_app_version_checker/ios/flutter_app_version_checker.podspec下的podspec文件无效。
[!] 因未指定平台,自动为Runner目标分配iOS平台及版本12.0。请在Podfile中为此目标指定平台。
完整错误日志
准备中 分析依赖项 检查待集成的目标 使用`ARCHS`设置构建`Pods-Runner`目标的架构:(``) 使用`ARCHS`设置构建`Pods-RunnerTests`目标的架构:(``) 获取外部源 -> 从`Flutter`获取`Flutter`的podspec -> 从`.symlinks/plugins/cloud_firestore/ios`获取`cloud_firestore`的podspec cloud_firestore: 使用`firebase_core`中定义的Firebase SDK版本'10.25.0' -> 从`.symlinks/plugins/device_info_plus/ios`获取`device_info_plus`的podspec -> 从`.symlinks/plugins/file_picker/ios`获取`file_picker`的podspec -> 从`.symlinks/plugins/firebase_core/ios`获取`firebase_core`的podspec firebase_core: 使用`firebase_core`中定义的Firebase SDK版本'10.25.0' -> 从`.symlinks/plugins/firebase_crashlytics/ios`获取`firebase_crashlytics`的podspec 警告:firebase_app_id_file.json文件不存在,这可能会导致upload-symbols出现问题。若此错误非预期,请尝试重新运行flutterfire configure。 firebase_crashlytics: 使用`firebase_core`中定义的Firebase SDK版本'10.25.0' -> 从`.symlinks/plugins/firebase_messaging/ios`获取`firebase_messaging`的podspec firebase_messaging: 使用`firebase_core`中定义的Firebase SDK版本'10.25.0' -> 从`.symlinks/plugins/flutter_app_version_checker/ios`获取`flutter_app_version_checker`的podspec [!] 路径`/Users/abdullahghanayem/StudioProjects/menatracks/ios/.symlinks/plugins/flutter_app_version_checker/ios/flutter_app_version_checker.podspec`下的podspec文件无效。 /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:755:in `block in from_string' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:752:in `chdir' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:752:in `from_string' /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/specification.rb:733:in `from_file' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/external_sources/abstract_external_source.rb:164:in `store_podspec' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/external_sources/path_source.rb:17:in `block in fetch' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/external_sources/path_source.rb:11:in `fetch' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:997:in `fetch_external_source' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:976:in `block (2 levels) in fetch_external_sources' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:975:in `each' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:975:in `block in fetch_external_sources' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:974:in `fetch_external_sources' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/analyzer.rb:118:in `analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:422:in `analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:243:in `resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:162:in `install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.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.15.2/lib/cocoapods/command.rb:52:in `run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>' /usr/local/bin/pod:23:in `load' /usr/local/bin/pod:23:in `<main>' CocoaPods错误输出: ↳ [!] 因未指定平台,自动为`Runner`目标分配`iOS`平台及版本`12.0`。请在Podfile中为此目标指定平台。
已尝试操作:
flutter clean- 进入ios目录执行
pod install
解决方案
1. 修复flutter_app_version_checker的podspec问题
- 升级插件版本:在
pubspec.yaml中更新flutter_app_version_checker到最新版本,执行flutter pub get - 清除插件缓存:
rm -rf ~/.pub-cache/hosted/pub.dartlang.org/flutter_app_version_checker-* flutter pub get - 若仍无效,替换为功能类似的插件(如
package_info_plus)
2. 指定Podfile的iOS平台版本
打开ios目录下的Podfile,修改平台配置为适配iOS 18的版本(建议最低14.0):
platform :ios, '14.0'
3. 清理并重新构建
执行以下命令完成全量清理与依赖安装:
flutter clean rm -rf ios/Pods ios/Podfile.lock ios/.symlinks flutter pub get cd ios pod install --repo-update
4. 处理Firebase警告(可选)
若需解决firebase_app_id_file.json不存在的警告,重新运行:
flutterfire configure
内容的提问来源于stack exchange,提问作者Abdullah Ghanayem
相关产品推荐
相关产品推荐

