微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flutter Firestore ld:找不到架构 x86_64

如何解决Flutter Firestore ld:找不到架构 x86_64

我正在尝试应用补丁以减少 ios 14.4 Flutter 应用程序的构建时间。

该补丁通过编辑 ios podfile 来使用特定包的预编译二进制文件,而不是下载整个 firebase SDK 并搜索所需的内容

通过修改 FirebaseFirestore Pod 以重定向到 github 存储库,并通过编辑 post_install 例程将最低操作系统版本替换为与 Xcode 兼容的版本来应用此修复程序。完整的 podfile 如下:

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
  pod 'FirebaseFirestore',:git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git',:tag => '7.3.0'
  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)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

进行这些更改会导致构建失败错误包括一长串插件折旧警告、文件 Pod 被忽略的警告以及架构 x86_64 的未定义符号,示例如下

  • 折旧警告:

/Users/administrator/development/Flutter/.pub-cache/hosted/pub.dartlang.org/location-3.2.4/ios/Classes/LocationPlugin.m:102:32: 警告: 'authorizationStatus' 已弃用:首先在 iOS 14.0 中弃用 [-Wdeprecated-declarations] 如果([CLLocationManager 授权状态] == kCLAuthorizationStatusDenied){ ^~~~~~~~~~~~~~~~~~~ 授权状态 在从 /Users/administrator/development/Flutter/.pub-cache/hosted/pub.dartlang.org/location-3.2.4/ios/Classes/LocationPlugin.m:4 导入的模块“CoreLocation”中: /Applications/Xcode.app/Contents/Developer/Platforms/iPhonesimulator.platform/Developer/SDKs/iPhonesimulator14.4.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h:218:1:注意:' AuthorizationStatus' 已在此处明确标记为已弃用 + (CLAuthorizationStatus)authorizationStatus API_DEPRECATED_WITH_REPLACEMENT("-authorizationStatus",ios(4.2,14.0),macos(10.7,11.0),watchos(1.0,7.0),tvos(9.0,14.0)); ^

  • Pod 被忽略:

ld:警告:忽略文件 Pods/FirebaseFirestore/FirebaseFirestore/BoringSSL-GRPC.xcframework/ios-arm64_armv7/BoringSSL-GRPC.framework/BoringSSL-GRPC,缺少文件 Pods/FirebaseFirestore/FirebaseFirestore/BoringSSL-GRPC 中所需的架构 x86_64 .xcframework/ios-arm64_armv7/BoringSSL-GRPC.framework/BoringSSL-GRPC(2个切片)

  • 未定义的符号:

体系结构 x86_64 的未定义符号: “_FIRFirestoreErrorDomain”,引用自: ___63-[FLTTransactionStreamHandler onListenWithArguments:eventSink:]_block_invoke in cloud_firestore(FLTTransactionStreamHandler.o) “OBJC_CLASS$_FirsnapshotMetadata”,引用自: objc-class-ref in cloud_firestore(FLTFirebaseFirestoreWriter.o)

我是 Flutter/xcode 编程的新手,所以我正在努力理解这个错误输出,并确定哪些信息与找到解决方案相关。任何帮助将不胜感激。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。