I've used the Google Analytics SDK (pod 'GoogleAnalytics'
) in my project for 8 years. It has always worked, until I recently moved to a new Mac with an M1 chip. On the new MacBook Pro, I can build and run the app on a test device. 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:
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.
So is there any way to fix the build for Xcode Simulators that run on Apple Silicon?
Google Analytics is shipped as a compiled binary, and support for M1 macs will have to be added by Google itself.
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