Swift | GoogleSignIn pod: 正在构建 iOS 模拟器版本,但链接到为 arm64 架构的 iOS 文件构建的目标文件。

5

我在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)

尝试了所有可能的解决方案(感觉它们都在 Xcode 版本 12 及以下),强制在 arm64 设置中指定也没有帮助:其他 Pod 无法运行(FirebaseAuth、Firebase/Analytics、Firebase/Firestore、Firebase/Storage)。
有一种感觉,需要强制启动仅针对“问题”Pod 的 arm64 引擎(在我的情况下,是 GoogleSignIn)。那么问题是,如何实现这一点,是否可能?
Podfile:
# 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

Pod版本:

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)

你的podfile怎么样了?分析?Firebase的版本是多少? - Jay
我更新了所有的pods,并添加了所有相关的pod版本。 - Andreas
谢谢,Jay。我已经找到问题所在了。我试图使用“pod install”命令更新所有的pods,但Firebase仍然停留在7.11版本。我还尝试了“pod deintegrate”和“pod clean”命令。你能告诉我是否有其他更新Firebase的方法吗? - Andreas
我的pod文件中只有6个pods,但是在执行pod update命令后,控制台中出现了更多的依赖关系。 - Andreas
+++ 仍然存在问题 - Andreas
显示剩余11条评论
2个回答

5

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

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

在浏览Firebase-ios-sdk存储库几天后,我尝试通过使用$FirebaseSDKVersion = '8.0.0'来覆盖我的podfile的firebase依赖项。

之后,我删除了所有指定的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

之后,所有错误都已消失,我的应用程序正常运行...


3
  1. add post_install on Podfile
    post_install do |installer|  
      installer.pods_project.build_configurations.each do |config|   
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'   
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"  
      end
    end
    
  2. After adding this code install pod
    pod install or pod update
    
  3. Go to Project Targets --> Build Settings --> Debug --> add "arm64" in Any SDK enter image description here

祝你好运


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接