gpt4 book ai didi

ios - Flutter Podfile 和 Firebase

转载 作者:行者123 更新时间:2023-11-28 23:44:42 25 4
gpt4 key购买 nike

pod 'Firebase/Core' 应该放在 Podfile 中的什么位置?当 Podfile 看起来像这样时很明显:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'Runner' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Runner
pod 'MaterialControls', '~> 1.2.2'
end

但我项目的默认 Podfile 如下所示:

# 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'

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
use_frameworks!

# 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

而且,诚然,我无法完全破译它来确定将它放在哪里。它是否在 use_frameworks! 之后进入 target 'Runner' do block ?或者也许在 ENV['COCOAPODS_DISABLE_STATS'] = 'true' 之后的文件顶部?任何指导将不胜感激。此外,如果您能阐明代码本身,那将是一个受欢迎的奖励。

最佳答案

在下面添加 use_frameworks! 然后安装 pod。

关于ios - Flutter Podfile 和 Firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52827767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com