(iOS)Manage Firebase environments for Development & Production effectively 🎯

Photo by Diggity Marketing on Unsplash

As a mobile developer you might have used Firebase SDKs in your complex projects for different purposes.

When we create a new Firebase project in the Firebase console, we are actually creating a Google Cloud project behind the scenes. You can think of a Google Cloud project as a virtual container for data, code, configuration, and services. A Firebase project is a Google Cloud project that has additional Firebase-specific configurations and services.

Firebase provides many amazing features like data analytics, Remote config services, Crash reports, A/B testing, etc.

In this article we will learn why it is crucial to have separate configuration for Development & Production builds. 👀

Problems if we use same config environment for Development & Production (for both Android & iOS)😧

0. Remote config service 👀

If we are using a Remote config service in our app, it is not recommended to work on Live Remote config objects directly for development or testing purposes. It becomes very risky especially when we are manipulating the live objects as it may impact live users.

1. Firebase Crash report 📈

Most of the time we face App crashes while in the development or testing process. We do not want to pollute our crashlytics data report for production builds. We need to classify crashes coming from Developers/Tester & from Real users.

2. Analytics data 📊

For getting accurate data to understand User behaviour and react appropriately we need to segregate analytical data. Another potential source of data pollution could be from our own Development & QA process which will hamper tracking of user sessions & actions if we use same config environment.

3. For better project management (Access permission) 🤝

When there are multiple developers working in a team, it is not desired to give add/delete permissions of Production Firebase projects to everyone. Having a debug environment will give complete freedom & sense of relaxation especially for Freshers to work/play with.

4. A/B testing or any new feature ⏳

Having separate environments provides freedom to experiment or test (New features of Firebase) without risking the corruption of production data.

5. Firebase notification ⛳️

Having Debug environment for testing notification helps as it will be disastrous to test notification on live users

Now let’s talk about solution & how we can achieve that 🤔

Photo by Riccardo Annandale on Unsplash

💡Solution (For iOS) :

Set up separate Firebase config environment for Development and Production

We will be creating two separate Firebase projects, which will give two separate GoogleService-Info.plist files. Now depending on the build configuration we will swap these pList files.


Refer this for Firebase set up(If not done) : https://firebase.google.com/docs/ios/setup

0) We need to have two separate projects with the same Bundle Id. Create another Firebase project for Debug/Development environment.

Name it appropriately so that you don’t get confuse.

1) Create an iOS App for a newly created project.

2) Now download the GoogleService-Info.plist for Debug build from console.

3) For better project structure in Xcode, create Firebase Config folder & then create Debug & Release child folders.

4) Copy the GoogleService-Info.plist corresponding to the Firebase Development environment into the Debug directory. Similarly, copy the GoogleService-Info.plist corresponding to Firebase production environment into the Release directory.

For Reference

5) Do not forget to uncheck all targets under the “Add to targets” option for both GoogleService-Info.plist files. To verify this open up the Utilities Panel (right side) and uncheck the files from any targets that may be in there for both.

We are doing this because we will configure the environment depending on the build we want.

If we want a debug build for development/testing, we will uncheck Release file & check Debug file and then create the build & vice versa.

Note : At a time only one file should be checked to targets.

Now we can either check/uncheck these files manually or we can add a script for it so that Xcode will copy desired file into final app bundle.

Please refer this awesome blog for using an Xcode Run Script Build Phase:




Moving fast without breaking things 👨‍💻……. Exploring Mobile Apps development

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Announcement: Removing DApp List Feature in iOS Version

Flutter: Use Platform Widgets to Adopt Native Look and Feel

Apple WWDC 2020

WWDC 22 Is A Week Away! — Some Crucial Info You Shouldn’t Miss

A Memoji watching WWDC

Prototyping Instagram‘s login screen using UIStackView

LastPass clone — part 11:

In App Rating Popup(Apple Rating Popup)

How To Make A macOS Menu Bar App

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rushabh Singh

Rushabh Singh

Moving fast without breaking things 👨‍💻……. Exploring Mobile Apps development

More from Medium

iOS library support both Cocoapods and Swift Package Manager

Build UITableView Sections With Nested Types

SOLID-The open-close principle in Swift

iOS Application States