Debugging Firebase events with Swift iOS apps
This post assumes that a Firebase project has been setup with Google Analytics enabled.
To be able to debug Firebase events in Swift apps, Firebase requires certain arguments to be passed when running the app. The details are available in the Firebase docs.
In xcode, the -FIRDebugEnabled
option has to be added to the Scheme that is being used to build the app.
In the area where you see the current scheme and the device/simulator used to run the app, click on the scheme to reveal a menu with the option to edit the scheme.
Find the “Run” option in the sidebar for the Debug release.
Find the “Arguments” tab in this window.
Add
-FIRDebugEnabled
as the arguments to be passed for launch. The hyphen is important :)
Testing Firebase events
Firebase events can be tested on the Google Analytics project connected to Firebase. Login to Google Analytics and find the Google Analytics property associated with the Firebase project.
In the Google Analytics property, under the admin panel, find the Data Display menu option, and then the Debug View under it.
Run your app in xcode, either in a simulator or an iOS device. While you use the device, the events should show up in the Google Analytics debug view.
Important: The events are only logged in the Debug View when the app is run via xcode.