斯威夫特 | GoogleSignIn pod:为 iOS 模拟器构建,但链接到为架构 arm64 的 iOS 文件构建的目标文件

And*_*eas 5 firebase swift google-signin apple-m1

我在M1上的模拟器中运行项目时遇到问题(这样的真实设备没有问题)。安装 GoogleSignIn pod 后,项目停止编译模拟器,并出现以下错误 - https://tppr.me/JpMll

building for iOS Simulator, but linking in object file built for iOS, file '/......../GoogleSignIn.framework/GoogleSignIn' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

尝试了所有可能的解决方案(感觉它们都在 Xcode 版本高达 12 下)。在arm64设置中强制指定也无济于事:其他pod脱落(FirebaseAuth、Firebase/Analytics、Firebase/Firestore、Firebase/Storage)。

有一种感觉,有必要仅针对“问题”pod(在我的例子中,它是GoogleSignIn)强制启动arm64引擎。那么问题是,如何才能做到这一点,有可能吗?

播客文件:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'iChat' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for iChat
  pod 'Firebase/Analytics'
  pod 'GoogleSignIn'
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'Firebase/Storage'
  pod 'SDWebImage'

end
Run Code Online (Sandbox Code Playgroud)

吊舱版本:

Installing AppAuth (1.4.0)
Installing BoringSSL-GRPC (0.0.7)
Installing Firebase (7.11.0)
Installing FirebaseAnalytics (7.11.0)
Installing FirebaseAuth (7.11.0)
Installing FirebaseCore (7.11.0)
Installing FirebaseCoreDiagnostics (7.11.0)
Installing FirebaseFirestore (7.11.0)
Installing FirebaseInstallations (7.11.0)
Installing FirebaseStorage (7.11.0)
Installing GTMAppAuth (1.2.1)
Installing GTMSessionFetcher (1.5.0)
Installing GoogleAppMeasurement (7.11.0)
Installing GoogleDataTransport (8.4.0)
Installing GoogleSignIn (5.0.2)
Installing GoogleUtilities (7.3.1)
Installing PromisesObjC (1.2.12)
Installing SDWebImage (5.11.1)
Installing abseil (0.20200225.0)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing leveldb-library (1.22.1)
Installing nanopb (2.30908.0)
Run Code Online (Sandbox Code Playgroud)

Bet*_*bus 5

最近我在尝试使用 Flutter 构建 ios 项目时遇到了同样的警告......

我尝试按照 firebase 文档中的步骤手动安装 pod,但没有成功。

经过几天的滚动浏览 Firebase-ios-sdk 存储库后,我尝试使用以下命令覆盖我的 podfile 的 firebase 依赖项$FirebaseSDKVersion = '8.0.0'

之后,我删除了所有 firebase 指定的 pod,例如pod 'Firebase/Analytics' 等等......

关于您的问题,即链接对象问题,我发现了这个问题并尝试遵循解决方案

我在 post_install do |installer| 之后在我的 podfile 中添加了另一行

我的 post_install 看起来像这样

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['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
     config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

Run Code Online (Sandbox Code Playgroud)

之后,所有错误都消失了,我的应用程序运行完美......