Guide to Integrate Firebase SDKs into IOS Project

This article contains a step by step guide explaining how to integrate Firebase SDKs into your IOS Project.

Prerequisite:

First of all, you need to create a project into Firebase Console if you have not already created it. To create a project into Firebase Console you can follow our guide, Firebase integration for beginners.

Steps to Integrate Firebase into Your IOS Project

1. Go to Firebase Console and click on your Project you just created in the previous guide.

2. On the project page, you will see an option to add a platform to your Project. Click on the IOS Platform. The screenshot is the following.

Add IOS Platform into Firebase Project
Add IOS Platform into Firebase Project

Register IOS App on Firebase

3. On the next page, you need to add your App details. IOS bundle Id, Your App Nickname (App will be visible in Firebase Console with this name) and optional App Store Id (If the app is already published on Appstore). After filling the details, press the Register App button, as shown in the following screenshot.

Register IOS App into Firebase Console
Register IOS App into Firebase Console

4. Firebase will automatically create a file named GoogleService-Info.plist. you need to download it and add it to your project. For that open your Xcode, and drag and drop the file from your Finder window to the left Project Navigator under your project directory, as shown in the following screenshot.

Copy Google Service Plist into Xcode Project
Copy Google Service Plist into Xcode Project

Add Firebase SDK Pods into IOS Project

5. Now you need to add Firebase SDK into your IOS project. You only need to add that SDK which service you need to use, like Firebase Authentication, Firebase Database, Storage and others. Here you can find the List of Firebase SDKs for IOS. Here in the demo, I will only add Firebase Analytics.

6. Firebase recommends using Cocoapods to import its libraries. If Cocoapods is not installed in your Mac, follow these Guidelines to Install Cocoapods into Mac. If it’s already installed you can skip.

7. Now, open the Terminal window and navigate to your project directory and run the following command to create PodFile in your project. If you have already created PodFile for some other Pods, you can skip this step as well. The screenshot is the following.

pod init
Create Pod File and Initialize Cocoapods
Create Pod File and Initialize Cocoapods

8. Now open your PodFile in Xcode and add Firebase Pods under target 'YOU_PROJECT' do use_frameworks! like,

 target 'YOUR_PROJECR' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # Pods for YOUR_PROJECR
  pod 'Firebase/Analytics'
Add Firebase Pods in PodFile
Add Firebase Pods in PodFile

9. Now in your terminal, navigate to your project directory & run the following command. It will download Firebase libraries and will add to your project.

pod install

10. Now close Xcode and open it again by clicking on the newly generated file Your_Project.xcworkspace file from your project directory. Also, don’t forget to click on Continue to Console button in your Firebase console to complete your IOS App registration. As shown in the following screenshot.

Complete Firebase IOS App Registration
Complete Firebase IOS App Registration

11. Now the final step is to initialize Firebase SDK in your project. For that add the following code in your AppDelegate‘s application didFinishLaunchingWithOptions method.

FirebaseApp.configure()
Initialize Firebase SDK In Your AppDelegate.swift
Initialize Firebase SDK In Your AppDelegate.swift

That’s it!! This is how you can Integrate Firebase SDKs into IOS Project. Now you can build your App and enjoy Firebase Libraries 🙂

You can also find other useful helping materials and tutorials in our Coding Articles & Tutorials Knowledge Base.

Native Mobile Application Developer (Android + IOS) having experience in Java, Swift, Kotlin, Objective C, Unity, C#, C/C++, NODE JS & PHP.

2 thoughts on “Guide to Integrate Firebase SDKs into IOS Project

  1. What i do not understood is actually how you are not really much more well-liked than you may be right now. You are very intelligent. You realize thus significantly relating to this subject, produced me personally consider it from a lot of varied angles. Its like men and women aren’t fascinated unless it’s one thing to do with Lady gaga! Your own stuffs outstanding. Always maintain it up!

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.