flutter之CocoaPods could not find compatible versions for pod "xxPlugin""

運行 flutter build ios 的時候報錯Error running pod install,中間的報錯信息如下:

[!] CocoaPods could not find compatible versions for
    pod "xxPlugin":
      In Podfile:
        FlutterPluginRegistrant (from
        `Flutter/FlutterPluginRegistrant`) was resolved to
        0.0.1, which depends on
          xxPlugin

        xxPlugin (from
        `Flutter/.symlinks/xxPlugin/ios`)

因爲 flutter build ios 的時候會運行 pod install 命令,而 ios(或者.ios)下的 PodFile文件如下

platform :ios, '8.0'

flutter_application_path = '../'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

use_frameworks!

target 'Runner' do
  install_flutter_engine_pod
  install_flutter_plugin_pods flutter_application_path
end

會根據 path : ios/Flutter/FlutterPluginRegistrant/ 本地引用FlutterPluginRegistrant

FlutterPluginRegistrant.podspec 內會引用所有的 plugin(有iosandroid代碼)

#
# Generated file, do not edit.
#

Pod::Spec.new do |s|
  s.name             = 'FlutterPluginRegistrant'
  s.version          = '0.0.1'
  s.summary          = 'Registers plugins with your flutter app'
  s.description      = <<-DESC
Depends on all your plugins, and provides a function to register them.
                       DESC
  s.homepage         = 'https://flutter.dev'
  s.license          = { :type => 'BSD' }
  s.author           = { 'Flutter Dev Team' => '[email protected]' }
  s.ios.deployment_target = '8.0'
  s.source_files =  "Classes", "Classes/**/*.{h,m}"
  s.source           = { :path => '.' }
  s.public_header_files = './Classes/**/*.h'
  s.static_framework    = true
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
  s.dependency 'Flutter'
  s.dependency 'bridgePlugin'
  s.dependency 'flutter_boost'
end

查看下所有的 pluginpodspec 中指定的 ios 版本要求,是否高於 ios 文件夾下 PodFile 的版本,如果高於,修改即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章