【问题标题】:"Running pod install..." infinitely“运行 pod install...” 无限
【发布时间】:2019-09-12 13:08:19
【问题描述】:

我想在 IOS Simulator 上运行我的应用程序 flutter App,但它显示“running pod install...”无限

我试图找到解决方案,但找不到任何解决方案。

这是我的 pod 文件,它是由 cocoa pod 自动生成的:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

预期的结果是“该应用程序应该很快在 IOS 模拟器上运行”,但它卡在“正在运行 pod install...” 然后给出以下错误: 因为没有指定平台,所以在目标Runner 上自动分配平台ios 和版本8.0。请在您的 Podfile 中为此目标指定一个平台。见https://guides.cocoapods.org/syntax/podfile.html#platform

【问题讨论】:

    标签: ios flutter


    【解决方案1】:

    从 iOS 文件夹中删除 podfile.lock 文件,然后转到 ios 文件夹并运行以下命令

    Pod install
    

    它将安装您的 podfile 中的所有包。

    另外,您需要设置目标平台。留在 iOS 文件夹中并运行以下命令

    open Runner.xcworkspace
    

    然后您的应用程序将在 XCode 中打开。单击“Runner”并将您的目标平台设置为 8.0。我用这个解决了我的 iOS 构建问题,希望这对你有用。

    【讨论】:

    • 这里是错误消息:!] 无法确定以下 pod 的 Swift 版本:-geolocator 没有指定 Swift 版本,并且集成它的目标 (Runner) 都没有SWIFT_VERSION 属性集。请联系作者或在至少一个集成此 pod 的目标中设置SWIFT_VERSION 属性。
    • 您是否使用任何库进行地理定位?
    • 不,我正在使用颤振插件,我认为问题是由于未指定的 swift 版本。我深入研究问题以找到解决方案。
    【解决方案2】:

    使用终端。 转到您的 ios 文件夹 跑步 pod install --verbose 你会看到发生了什么

    【讨论】:

      【解决方案3】:

      如果您是在最近使用 Apple Silicon 的 M1 Mac 上进行开发,则在安装 Cocoapods 后可能需要额外的命令,发现 here

      sudo gem install ffi
      

      【讨论】:

        猜你喜欢
        • 2017-03-26
        • 1970-01-01
        • 2017-11-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-26
        • 2020-05-29
        • 2021-12-21
        相关资源
        最近更新 更多