在 flutter 中生成 Podfile 的正确方法是什么?
Which is the right way to generate a Podfile in flutter?
对我来说,删除后生成pod文件有两种方法
第一个是运行ning 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
然后 运行ning 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 安装...
这是使用 flutter 和构建以及 运行 ios 应用程序的正确方法,因为我很困惑,我不能 运行 我的应用程序 ios 形式。
更多细节在此 issue 如果有人帮助我我会很高兴
您是否尝试删除 pod 文件夹并且 运行
Flutter 获取酒吧
比 pod install ?
好吧,在 flutter 中,您不必像这样在 Podfile 中安装 pods
pod 'Firebase/Messaging'
只需将它们放入您的 pubspec 文件中,然后 运行 pod clean
然后删除您的 Podfile 然后 运行 flutter pub get
flutter 将为您生成 Podfile,然后您应该只取消注释第二行和 运行 pod install
然后 运行 你的应用程序
对我来说,删除后生成pod文件有两种方法 第一个是运行ning 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
然后 运行ning 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 安装... 这是使用 flutter 和构建以及 运行 ios 应用程序的正确方法,因为我很困惑,我不能 运行 我的应用程序 ios 形式。 更多细节在此 issue 如果有人帮助我我会很高兴
您是否尝试删除 pod 文件夹并且 运行 Flutter 获取酒吧 比 pod install ?
好吧,在 flutter 中,您不必像这样在 Podfile 中安装 pods
pod 'Firebase/Messaging'
只需将它们放入您的 pubspec 文件中,然后 运行 pod clean
然后删除您的 Podfile 然后 运行 flutter pub get
flutter 将为您生成 Podfile,然后您应该只取消注释第二行和 运行 pod install
然后 运行 你的应用程序