对于我来说,删除后生成pod文件有两种方法 第一个是运行 flutter pub get ,编辑后会生成如下形式的 pod 文件
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
pod 'Firebase/Analytics' #ATTENTION PLEASE SHOULD I ADD THESE PODS HERE?
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
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
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0’
end
end
end
然后运行 pod install
另一个实现是当我运行 pod init 时,经过一些编辑后,我得到以下内容:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
target 'Runner' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Runner
end
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0’
end
end
end
然后运行 pod install... 这是使用 flutter 以及构建和运行 ios 应用程序的正确方法,因为我很困惑,并且无法以 ios 形式运行我的应用程序。 更多详细信息在此问题如果有人帮助我,我会很高兴
好吧,在 flutter 中你不必像这样在 Podfile 中安装 pod
pod 'Firebase/Messaging'
只需将它们放入您的pubspec文件中,然后运行pod cache clean --all
,然后删除您的Podfile,然后运行flutter pub get
,flutter将为您生成Podfile,然后您应该取消注释第二行并运行pod install
,然后运行您的Podfile应用程序
您是否尝试删除
pod
文件夹并运行
flutter pub get
然后pod install
?