首页 > 解决方案 > 如何删除在 Flutter 中安装的不需要的 Pod

问题描述

我是 Flutter 开发的新手。我在将 Flutter iOS 与 Xcode 一起使用时发现问题。我可以看到安装了不需要的 Pod,这会在我的 Xcode 构建过程中导致错误。我想知道是否有办法控制安装的 Pod。

以下是我的 Podfile 的代码:

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

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

pod 'Firebase/Auth'
pod 'Firebase/Analytics'
pod 'Firebase/Core'


def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

#install! 'cocoapods', :deterministic_uuids => false

target 'Runner' do
  #use_frameworks!
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

由于 GoogleUtilities(unwanted pod),我收到以下错误:

GoogleUtilities/GULAppEnvironmentUtil.h' file not found

标签: iosxcodefluttercocoapodspodfile

解决方案


推荐阅读