无限地“正在运行pod安装...”

时间:2019-04-23 10:55:16

标签: ios flutter

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

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

这是我的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安装中...” 然后给出以下错误: 由于未指定平台,因此自动在目标ios上为平台8.0分配了版本Runner。请在您的Podfile中为此目标指定一个平台。参见https://guides.cocoapods.org/syntax/podfile.html#platform

3 个答案:

答案 0 :(得分:3)

使用终端。 转到您的ios文件夹 跑 let regex = '(a|e|i|o|u)' let re = new RegExp(regex, 'g'); str = str.replace(re, replaceStr); console.log(str) 您将看到发生了什么

答案 1 :(得分:1)

Delete the podfile.lock file from iOS folder after that go to ios folder and run a bellow command

Pod install

It will install all the packages which are in your podfile.

Also, you need to set the target platform. Stay in the iOS folder and run below command

open Runner.xcworkspace

then your app will be open in XCode. Click on the "Runner" and set your target platfor to 8.0. I fix my iOS build issue using this hope this will work for you.

答案 2 :(得分:0)

如果您正在使用 Apple Silicon 的最新 M1 Mac 上进行开发,则在安装 Cocoapods found here 后,您可能需要一个额外的命令。

sudo gem install ffi