Add Firebase to your iOS project


  • Install the following:

    • Xcode 10.3 or later
    • CocoaPods 1.4.0 or later
  • Make sure that your project meets the following requirements:

    • Your project must target iOS 8 or later.
    • Swift projects must use Swift 3.0 or later.
  • Set up a physical iOS device or the iOS simulator for running your app.

    • For Cloud Messaging, complete the following tasks:

      • Set up a physical iOS device.
      • Obtain an Apple Push Notification Authentication Key for your Apple Developer account.
      • Enable Push Notifications in XCode under App > Capabilities.
    • For all other Firebase products, you can use either a physical iOS device or the iOS simulator.

  • Sign into Firebase using your Google account.

If you don't already have an Xcode project and just want to try out a Firebase product, you can download one of our quickstart samples.

Step 1: Create a Firebase project

Before you can add Firebase to your iOS app, you need to create a Firebase project to connect to your iOS app. Visit Understand Firebase Projects to learn more about Firebase projects.

Step 2: Register your app with Firebase

After you have a Firebase project, you can add your iOS app to it.

Visit Understand Firebase Projects to learn more about best practices and considerations for adding apps to a Firebase project, including how to handle multiple build variants.

  1. In center of the Firebase console's project overview page, click the iOS icon (plat_ios) to launch the setup workflow.

    If you've already added an app to your Firebase project, click Add app to display the platform options.

  2. Enter your app's bundle ID in the iOS bundle ID field. Find your bundle ID, as follows:

    1. Open your app in XCode.

    2. Select the top-level app in the project navigator, then select the General tab.

      The value of the Bundle Identifier field is the iOS bundle ID (for example, com.yourcompany.yourproject).

  3. (Optional) Enter other app information as prompted by the setup workflow.

  4. Click Register app.

Step 3: Add a Firebase configuration file

  1. Click Download GoogleService-Info.plist to obtain your Firebase iOS config file (GoogleService-Info.plist).

    • You can download your Firebase iOS config file again at any time.

    • Make sure the config file is not appended with additional characters, like (2).

  2. Move your config file into the root of your Xcode project. If prompted, select to add the config file to all targets.

If you have multiple bundle IDs in your project, you must associate each bundle ID with a registered app in the Firebase console so that each app can have its own GoogleService-Info.plist file.

Step 4: Add Firebase SDKs to your app

We recommend using CocoaPods to install the Firebase libraries. However, if you'd rather not use CocoaPods, you can integrate the SDK frameworks directly.

Note that if you're using one of the quickstart samples, the Xcode project and Podfile (with pods) are already present, but you'll still need to add your Firebase configuration file and install the pods.

You can add any of the supported Firebase products to your iOS app.

  1. Create a Podfile if you don't already have one:

    cd your-project-directory
    pod init
  2. To your Podfile, add the Firebase pods that you want to use in your app.

    Analytics enabled

    # Add the Firebase pod for Google Analytics
    pod 'Firebase/Analytics'
    # Add the pods for any other Firebase products you want to use in your app # For example, to use Firebase Authentication and Cloud Firestore pod 'Firebase/Auth' pod 'Firebase/Firestore'

    Analytics not enabled

    # Add the pods for the Firebase products you want to use in your app
    # For example, to use Firebase Authentication and Cloud Firestore
    pod 'Firebase/Auth'
    pod 'Firebase/Firestore'

  3. Install the pods, then open your .xcworkspace file to see the project in Xcode:

    pod install
    open your-project.xcworkspace

Step 5: Initialize Firebase in your app

The final step is to add initialization code to your application. You may have already done this as part of adding Firebase to your app. If you're using a quickstart sample project, this has been done for you.

  1. Import the Firebase module in your UIApplicationDelegate:


    import Firebase


    @import Firebase;
  2. Configure a FirebaseApp shared instance, typically in your app's application:didFinishLaunchingWithOptions: method:


    // Use Firebase library to configure APIs


    // Use Firebase library to configure APIs
    [FIRApp configure];

After you add the initialization code, run your app to send verification to the Firebase console that you've successfully installed Firebase.

Available pods

The following pods are available for the various Firebase products.

Firebase product Pods
AdMob pod 'Firebase/AdMob'
(required) pod 'Firebase/Analytics'
Analytics pod 'Firebase/Analytics'
Authentication pod 'Firebase/Auth'
Cloud Firestore pod 'Firebase/Firestore'
Cloud Functions for Firebase Client SDK pod 'Firebase/Functions'
Cloud Messaging pod 'Firebase/Messaging'
(recommended) pod 'Firebase/Analytics'
Cloud Storage pod 'Firebase/Storage'
Crashlytics pod 'Fabric'
pod 'Crashlytics'
(recommended) pod 'Firebase/Analytics'
Dynamic Links pod 'Firebase/DynamicLinks'
(recommended) pod 'Firebase/Analytics'
In-App Messaging pod 'Firebase/InAppMessaging'
(required) pod 'Firebase/Analytics'
ML Kit: Vision APIs pod 'Firebase/MLVision'
ML Kit: Image Labeling Model pod 'Firebase/MLVisionLabelModel'
ML Kit: Barcode Scanning Model pod 'Firebase/MLVisionBarcodeModel'
ML Kit: Text Recognition Model pod 'Firebase/MLVisionTextModel'
ML Kit: Face Detection Model pod 'Firebase/MLVisionFaceModel'
ML Kit: Object Detection and Tracking Model pod 'Firebase/MLVisionObjectDetection'
ML Kit: Natural Language APIs pod 'Firebase/MLNaturalLanguage'
ML Kit: Language Identification Model pod 'Firebase/MLNLLanguageID'
ML Kit: Translate Model pod 'Firebase/MLNLTranslate'
ML Kit: Smart Reply Model pod 'Firebase/MLNLSmartReply'
ML Kit: Custom Model APIs pod 'Firebase/MLModelInterpreter'
ML Kit: AutoML Vision Edge API pod 'Firebase/MLVisionAutoML'
Performance Monitoring pod 'Firebase/Performance'
Realtime Database pod 'Firebase/Database'
Remote Config pod 'Firebase/RemoteConfig'
(recommended) pod 'Firebase/Analytics'

Integrate without CocoaPods

If you don't want to use Cocoapods, you can still take advantage of the Firebase SDKs by importing the frameworks directly.

  1. Download the framework SDK zip. This is a ~1GB file and might take some time to download.

  2. Unzip the file, then review the README for the Frameworks that you want to include in your app.

  3. Add the ObjC linker flag in your Other Linker Settings in your target's build settings.

Next steps

Learn about Firebase:

Add Firebase services to your app: