简体   繁体   中英

Firebase Analytics events on iOS - test and production

The iOS app I am working on uses Firebase Analytics to report events. It works as expected, but the app is not in production yet. Once it is it would be preferable to have the events logged by real users separate from these logged when debugging.

What is the best way to have Firebase Analytics events logged separately for test and production?

First you will probably want to create a separate Firebase project for staging/debug.

Then you will have to configure your app to be able to use different resources based on build type. For Android we solved this using build flavors, not sure what the iOS equivalent is.

From docs ( https://firebase.google.com/docs/projects/multiprojects ):

By default, FirebaseApp.configure() will load the GoogleService-Info.plist file bundled with the application. If your development and production environments are configured as separate targets in XCode, you can:

  • Download both GoogleService-Info.plist files
  • Store the two files in different directories
  • Add both to your XCode project
  • Associate the different files with the different targets using the Target Membership panel.

If the builds are part of a single target, the best option is to give both configuration files unique names (eg GoogleService-Info-Free.plist and GoogleService-Info-Paid.plist). Then choose at runtime which plist to load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM