在 flutter 中生成 Podfile 的正确方法是什么?

Sha*_*yer 1 ios swift flutter podfile flutter-dependencies

对我来说,删除后生成 pod 文件有两种方法\n第一种是运行 flutter pub get ,然后编辑后会生成如下形式的 pod 文件

\n
# Uncomment this line to define a global platform for your project\n platform :ios, \'10.0\'\npod \'Firebase/Analytics\' #ATTENTION PLEASE SHOULD I ADD THESE PODS HERE?\npod \'Firebase/Auth\'\npod \'Firebase/Firestore\'\npod \'Firebase/Database\'\npod \'Firebase/Messaging\'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV[\'COCOAPODS_DISABLE_STATS\'] = \'true\'\n\nproject \'Runner\', {\n  \'Debug\' => :debug,\n  \'Profile\' => :release,\n  \'Release\' => :release,\n}\n\ndef flutter_root\n  generated_xcode_build_settings_path = File.expand_path(File.join(\'..\', \'Flutter\', \'Generated.xcconfig\'), __FILE__)\n  unless File.exist?(generated_xcode_build_settings_path)\n    raise "#{generated_xcode_build_settings_path} must exist. If you\'re running pod install manually, make sure flutter pub get is executed first"\n  end\n\n  File.foreach(generated_xcode_build_settings_path) do |line|\n    matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n    return matches[1].strip if matches\n  end\n  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"\nend\n\nrequire File.expand_path(File.join(\'packages\', \'flutter_tools\', \'bin\', \'podhelper\'), flutter_root)\n\nflutter_ios_podfile_setup\n\ntarget \'Runner\' do\n  use_frameworks!\n  use_modular_headers!\n\n  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |pi|\n    pi.pods_project.targets.each do |t|\n      t.build_configurations.each do |config|\n        config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'10.0\xe2\x80\x99\n      end\n    end\nend\n
Run Code Online (Sandbox Code Playgroud)\n

然后运行 ​​pod install

\n
\n

另一个实现是当我运行 pod init 时,经过一些编辑后我得到以下内容:

\n
# Uncomment the next line to define a global platform for your project\n platform :ios, \'10.0\'\npod \'Firebase/Analytics\'\npod \'Firebase/Auth\'\npod \'Firebase/Firestore\'\npod \'Firebase/Database\'\npod \'Firebase/Messaging\'\n\ntarget \'Runner\' do\n  # Comment the next line if you don\'t want to use dynamic frameworks\n  use_frameworks!\n\n  # Pods for Runner\n\nend\n\npost_install do |pi|\n    pi.pods_project.targets.each do |t|\n      t.build_configurations.each do |config|\n        config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'10.0\xe2\x80\x99\n      end\n    end\nend\n
Run Code Online (Sandbox Code Playgroud)\n

然后运行 ​​pod install...\n这是使用 flutter 以及构建和运行 ios 应用程序的正确方法,因为我很困惑,我无法以 ios 形式运行我的应用程序。\n更多详细信息在本期中,会如果有人帮助我,我会很高兴

\n

Sha*_*yer 6

好吧,在 flutter 中,你不必在 Podfile 中安装 pod,只需将 pod 'Firebase/Messaging'它们放入 pubspec 文件中,然后运行pod clean然后删除你的 Podfile,然后运行flutter pub get,flutter 将为你生成 Podfile,然后你应该取消注释第二行然后运行pod install然后运行你的应用程序