edit  Edit page
message  Send Feedback

Adding Firebase credentials to your iOS app

The Firebase console provides a GoogleService-Info.plist file containing a set of credentials for iOS devices to use when authenticating with your Firebase project.

We'll quickly walk through the process of retrieving this file and installing it into your iOS project.

Generating the credentials

The credential file can be generated from the Firebase console. After selecting your Firebase project, open the project settings by clicking on the gear icon and then navigate to 'Project Settings'.

Under 'Your apps', click on the iOS logo (highlighted in orange) to add a new iOS app to your Firebase project:

iOS Settings

Enter your application details then click on 'Register app'. The 'iOS bundle ID' must match your local iOS bundle ID.

iOS Register

Download the config file locally by pressing "Download GoogleService-Info.plist". Using Xcode, open the projects /ios/{projectName}.xcodeproj file (or /ios/{projectName}.xcworkspace if using Pods).

Right click on the project name and "Add files" to the project, as demonstrated below:

Add files

Select the downloaded GoogleService-Info.plist file and ensure the 'Copy items if needed' checkbox is enabled.

Select file

Next we need to initialize the Firebase service manually. To do this, open the AppDelegate file within your project /ios/{projectName}/AppDelegate.m.

At the top of the file import the Firebase module:

@import Firebase;

Within the didFinishLaunchingWithOptions method, add the configure method:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}

Rebuilding iOS

Your iOS project now needs to be rebuild to start using Firebase. Before doing so, ensure your projects Pods are up-to-date:

$ cd ios/
$ pod install --repo-update

Once complete, rebuild your iOS project from the project root using the React Native CLI:

$ cd ..
$ npx react-native run-ios

Next Steps

Once your iOS project is setup, you can follow the setup for getting started with Android, or get started using Firebase services.

React Native Market

Looking for pre-built React Native apps to kick start your next project? Check out the React Native Market by Invertase.

Your purchases help support our open-source projects such as React Native Firebase. All items are currently 50% off to celebrate the release of React Native Firebase version 6.
shopping_cartVisit React Native Market