解决Flutter出现CocoaPods报错情况(Mac和IOS)
作者:ClearBoth
错误情况
Launching lib/main.dart on iPad Pro (12.9-inch) (5th generation) in debug mode... main.dart:1 CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``) Finding Podfile changes A image_editor_dove - Flutter - file_picker - flutter_image_compress - flutter_secure_storage - image_gallery_saver - image_picker_ios - path_provider_foundation - sqflite Fetching external sources -> Fetching podspec for `Flutter` from `Flutter` -> Fetching podspec for `file_picker` from `.symlinks/plugins/file_picker/ios` -> Fetching podspec for `flutter_image_compress` from `.symlinks/plugins/flutter_image_compress/ios` -> Fetching podspec for `flutter_secure_storage` from `.symlinks/plugins/flutter_secure_storage/ios` -> Fetching podspec for `image_editor_dove` from `.symlinks/plugins/image_editor_dove/ios` [!] No podspec found for `image_editor_dove` in `.symlinks/plugins/image_editor_dove/ios` /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/external_sources/path_source.rb:14:in `block in fetch' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/external_sources/path_source.rb:11:in `fetch' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:997:in `fetch_external_source' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:976:in `block (2 levels) in fetch_external_sources' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:975:in `each' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:975:in `block in fetch_external_sources' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:974:in `fetch_external_sources' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:118:in `analyze' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:422:in `analyze' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:243:in `resolve_dependencies' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:162:in `install!' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/command/install.rb:52:in `run' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:52:in `run' /Users/shixin/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.0/bin/pod:55:in `<top (required)>' /usr/local/bin/pod:23:in `load' /usr/local/bin/pod:23:in `<main>' /Users/shixin/.rvm/rubies/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval' /Users/shixin/.rvm/rubies/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
分析解决
这种情况,首先在终端cd进入到Flutter项目相应的ios或者mac目录下
删除对应的Podfile.lock文件
运行
pod install --verbose --no-repo-update
在运行中,又可能会报错
情况1:
Specs satisfying the flutter_sound (from.symlinks/plugins/flutter_sound/ios) dependency were found, but they required a higher minimum deployment target.
解决办法
这种的,是包的版本问题
1.去目录的Pods - Local Podspecs - ”包名“ 打开以后找到
``` "platforms": { "osx": "10.14" }, ```
2.打开目录的PodFile,在第一行,
`platform :osx, '10.11'`
3.报错是因为包的平台版本要求跟我们定义的平台版本要求不一样,版本太低,所以改成跟包是一样的版本就可以了,保存以后继续重复情况1的pod install --verbose --no-repo-update命令
4.可能还会报错,这个时候全局搜索一下相应的配置,可能在Runner.xcodeproj的project.pbxproj中还有没有改正过来的平台版本号,改正一下。
5.现在再去更新命令,就会重新生成Podfile.lock文件了,并且可以重新启动
情况2:
[!] No podspec found for `device_info_plus` in `../hmc_flutter_module/.ios/.symlinks/plugins/device_info_plus/ios`
解决办法:
如图:
以上就是解决Flutter出现CocoaPods报错情况(Mac和IOS)的详细内容,更多关于Flutter CocoaPods报错解决的资料请关注脚本之家其它相关文章!