[英]How can I build the Google Analytics SDK on Apple Silicon ('M1') so it runs in the Xcode Simulator?
I've used the Google Analytics SDK ( pod 'GoogleAnalytics'
) in my project for 8 years.我在我的项目中使用 Google Analytics SDK ( pod 'GoogleAnalytics'
) 已经 8 年了。 It has always worked, until I recently moved to a new Mac with an M1 chip.它一直有效,直到我最近换了一台带有 M1 芯片的新 Mac。 On the new MacBook Pro, I can build and run the app on a test device.在新的 MacBook Pro 上,我可以在测试设备上构建和运行应用程序。 I can also archive and distribute the app.我还可以存档和分发应用程序。 But when I try to build my app for an Xcode Simulator , it fails with this message:但是,当我尝试为 Xcode Simulator 构建我的应用程序时,它会失败并显示以下消息:
ld: in /Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a(GAIUtil.o), building for iOS Simulator, but linking in object file built for iOS, file '/Pods/GoogleAnalytics/Libraries/libGoogleAnalytics.a' for architecture arm64
I'd like to keep using the Google Analytics SDK as it offers features that are missing in Firebase (which I'm also using), such as the ability to download data via an API for free.我想继续使用 Google Analytics SDK,因为它提供了 Firebase(我也在使用)中缺少的功能,例如通过 ZDB974238714CA8DE6434A7CE1D083A 免费下载数据的能力。
So is there any way to fix the build for Xcode Simulators that run on Apple Silicon?那么有什么方法可以修复在 Apple Silicon 上运行的 Xcode 模拟器的构建?
Google Analytics is shipped as a compiled binary, and support for M1 macs will have to be added by Google itself. Google Analytics 以编译后的二进制文件形式发布,对 M1 macs 的支持必须由 Google 自己添加。
Until they have done that and release an update, it's probably best if you exclude GA from your simulator builds, somewhat similar to the way described in Exclude pod when porting to mac with catalyst在他们完成此操作并发布更新之前,最好将 GA 从您的模拟器构建中排除,这有点类似于在使用催化剂移植到 mac 时排除 pod中描述的方式
Here is open issue in GitHub Firebase project regarding libGoogleAnalytics.a issue.这是 GitHub Firebase 项目中关于 libGoogleAnalytics.a 问题的未解决问题。
I want to encourage, that everyone who have this problem will open this url and post a message, that we need to solve this problem.我想鼓励每个有这个问题的人打开这个url 并发布消息,我们需要解决这个问题。
https://github.com/firebase/firebase-ios-sdk/issues/7509 https://github.com/firebase/firebase-ios-sdk/issues/7509
Gereon's answer makes sense. Gereon 的回答很有道理。 I'll wait for Google to roll out a new version of Google Analytics SDK.我将等待 Google 推出新版本的 Google Analytics SDK。 I hope they keep updating the SDK as it is such a valuable tool.我希望他们不断更新 SDK,因为它是如此有价值的工具。
And I just realized that, with the M1 Mac, I can directly build a Mac app from XCode.而且我刚刚意识到,使用 M1 Mac,我可以直接从 XCode 构建 Mac 应用程序。 That'll do.这样就行了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.