Search code examples
iosswiftxcodefirebasegoogle-fabric

Create multiple environment with same bundle id using firebase iOS swift?


We are working on fabric for a crash report. We have four environments debug, dev, prod, and staging. So based on the environment we have created the organization in fabric setting and get API key. So that we can able to use API key for different environments with the same bundle id.

For Fabric i have followed this link : Fabric Crashlytics multiple environments for iOS app

But now we have to move the fabric to firebase. We have created the project for my one environment. But I want to create multiple environments with same bundle id in firebase. Can anyone give me an idea?

Ref link : In this link they have created the dev and production for different bundle id. https://medium.com/bam-tech/setup-firebase-on-ios-android-with-multiple-environments-ad4e7ef35607


Solution

  • In Firebase, you can use multiple projects to support different environments.

    The Firebase Console will not prevent you from creating multiple projects having apps with the same bundle id (there is some subtlety when doing this on Android around SHA1 keys but it doesn't apply to iOS).

    It is up to you if you want to use the same bundle id or not:

    1. Use the same bundle id if you are okay with overwriting the prod app when testing on devices

    2. Use a different bundle id (e.g. append ".staging" or ".test") if you want to test side-by-side

    Be mindful that you will have to manage different GoogleService-Info.plist files since you are using two different Firebase projects, and be extra careful when deploying to App Store - you do not want to publish an app that points to your staging or test environments!

    Additional reading: https://firebase.google.com/docs/projects/multiprojects