Disable Crashlytics and Analytics data collection in debug builds#1054
Merged
aaronbrethorst merged 1 commit intoOneBusAway:mainfrom Feb 22, 2026
Conversation
aaronbrethorst
approved these changes
Feb 22, 2026
Member
aaronbrethorst
left a comment
There was a problem hiding this comment.
Hey Divesh — clean surgical fix. The #if DEBUG placement is correct: it runs after FirebaseApp.configure() (so Firebase doesn't crash from being unconfigured) but before Analytics.setUserID (which becomes a no-op once collection is disabled). I verified that setReportingEnabled(_:) only toggles Analytics, not Crashlytics, so the Crashlytics disable stays in effect for the entire debug session. And the only call site for setReportingEnabled is SettingsViewController, meaning a developer would have to deliberately re-enable analytics from the Settings UI — that's perfectly acceptable.
This looks good to merge. Thanks for keeping the production dashboards clean!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #632
Summary
Debug builds are currently sending crash reports and analytics events to Firebase, creating noise in the production Crashlytics dashboard. This PR disables data collection in debug builds.
Problem
FirebaseApp.configure()inFirebaseAnalytics.initruns unconditionally for all build configurations. This means every simulator run and debug session sends data to Crashlytics, making it harder to identify real user crashes in the Firebase console.Fix
Added a
#if DEBUGblock afterFirebaseApp.configure()that disables both Crashlytics and Analytics collection:Firebase is still configured (preventing crashes from unconfigured Firebase calls), but no data is collected or transmitted in debug builds.
Testing