我有 flutter 项目,我正在尝试运行 ios 版本,但在将 flutter 和 xcode 更新到最新版本后出现错误,我使用 firebase 核心插件
错误:
Could not build the precompiled application for the device.
Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
播客文件:
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# 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 |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
我还通过以下方式尝试了所有已安装的 pod:
pod deintegrate
rm Podfile.lock
rm -rf Pods
然后更新存储库并安装 pod,我仍然遇到相同的错误,我应该重新安装 xcode 吗?
Flutter 包:
firebase_core: ^2.8.0
firebase_crashlytics: ^3.0.17
firebase_analytics: ^10.1.6
firebase_messaging: ^14.3.0
有什么解决方法吗?谢谢你的时间
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
尝试更新您的 ios/Podfile
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
请将此文件夹粘贴到此目录中。 我也浪费了太多时间,但这将 100% 解决你的问题。
确保解压后文件夹名称为arc。 在最新的 Xcode 14.3 中,上述库中没有文件夹。所以,粘贴它。
https://drive.google.com/file/d/1rCjFeqt-U6y7SOtJ2fpeQwWkuQomDP8l/view?usp=share_link
从上面的驱动器 URL 下载并将其粘贴到提到的路径。
上面提到的网址是公开的。