Firebase Analytics to your Unit Project

While trying to build my project, I ran into a bunch of building issues, and want to just share what I had to do in order to fix them, here.

So, first of, my background is that I primary build for Android, and after this, I do the iPhone build, and upload to the App Store. This means, that often, I do not have the luxury of solving small problems, as they come along, but rather, I have to solve a bunch of problems that have build up over time.

In this instance, I have had the pleasure of moving from Unity Analytics, to using Firebase and Google for my analytics purposes. There is a lot of different reasons for this.. but in the end, it came down to price and integration, meaning that Unity is really expensive if you want to move it to something that is really worth something, and at the same time, it does not integrate easily with Google Ads and such.

The problems I encountered, was as follows, or several variations of this.

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
      objc-class-ref in libFirebaseCppApp.a(invites_receiver_internal_ios_aa7b75b2efc3269e88f1077e55250e5a.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To solve this, I followed the following steps

  1. Installing the GoogleService-Info.plist
  2. Installing latest version of Analytics and DynamicLinks
  3. Cocoapods update
  4. Open Workspace instead of Project

Before doing any of this, please make sure that you have updated Xcode to latest version, Unity to the latest version, and that the minimum iOS build support is 10.0

Google Service Info plist

The first thing I found out that I had forgotten, was to install the GoogleServive-Info.plist . I dont know how I could forget this, but it was probably a result of me doing all of the setting up and configuring on Android, and then doing the iPhone setup a month later, forgetting all about it. Again, I just followed the guide here https://firebase.google.com/docs/unity/setup and did as instructed.
However, the problem persisted.

Installing the latest version of Firebase Analytics

Again, I somehow, did not understand that I was supposed to keep this up to date, so again, I downloaded the latest version of the analytics from here https://firebase.google.com/docs/unity/setup and installed the latest version of “FirebaseAnalytics.unitypackage”.

On top of that, I found out, that when doing this on the Mac for iPhone, “FirebaseDynamicLinks.unitypackage” Please make sure that this is also installed.

Cocoapods update

For some reason, the latest version of Cocoapods is not installed with Unity, and this have to be done manually through the Terminal, so open the Terminal and Uninstall the current version of Cocoapods

sudo gem uninstall cocoapods

Then you install the newest version of cocoapods

sudo gem install cocoapods

Once this is done you should enable Cocoapods in Unity.

Go to “Assets > External Dependency Manager > iOS Resolver > Settings ”
Here you should enable the Cocoapods, do this by enabling
“Podfile Generation”

For Cocoapods Integrations, choose
“Xcode Workspace / Add Cocoapods to the Xcode workspace. “

Open the project with Workspace

So, this is just an old habit of mine, where I would always open the project file for xcode instead of the Workspace.

Since Cocoapods is set to the Workspace, this is of course what we should open. So, once the build is done, use the “Unity-iPhone.xcworkspace” file to open in Xcode.

Closing

I probably forgot a lot of things here, and next time I have to do this, I will encounter new problems, and with that, I will update this guide. At the same time, if you encounter something, and other solutions to this, please let me know, so that I can update the guide.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.