ios - "Running pod install..."无限

标签 ios flutter

我想在 IOS 模拟器上运行我的应用程序 flutter 应用程序,但它无限地显示“正在运行 pod 安装...”

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

这是我的 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 上自动分配版本为 8.0 的平台 ios。请在 Podfile 中为此目标指定一个平台。请参阅 https://guides.cocoapods.org/syntax/podfile.html#platform

最佳答案

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

Pod install

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

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

open Runner.xcworkspace

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

关于ios - "Running pod install..."无限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55809665/

相关文章:

iphone - 导航 Controller 上的后退按钮不会停止视频流 (IOS)

ios - self.view setNeedsDisplay 和 self.view setNeedsLayout 不起作用

objective-c - 调用委托(delegate)方法,无法识别的选择器,因为发送到错误的对象

ios - 二元运算符 '+' 不能应用于类型 'CGRect' 和 'Double'

firebase - 如何为有状态小部件编写测试?

flutter - 如何将容器的高度定义为默认值或什么都不定义

ios - 如何获得初始状态栏高度?

Flutter setState 函数

flutter - flutter 中的内阴影效果

firebase - Face 对象的属性在 firebase ml vision flutter 中始终为 null