Catch up on everything we announced at this year's Firebase Summit. Learn more

Add Firebase to your Apple project

Prerequisites

  • Install the following:

    • Xcode 12.5 or later
  • Make sure that your project meets these requirements:

    • Your project must target these platform versions or later:
      • iOS 10
      • macOS 10.12
      • tvOS 12
      • watchOS 6
  • Set up a physical Apple device or use a simulator to run your app.

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 Apple app, you need to create a Firebase project to connect to your 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 Apple 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. Go to the Firebase console.

  2. In the center of the project overview page, click the iOS+ icon to launch the setup workflow.

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

  3. Enter your app's bundle ID in the bundle ID field.

  4. (Optional) Enter other app information: App nickname and App Store ID.

  5. Click Register app.

Step 3: Add a Firebase configuration file

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

  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

Use Swift Package Manager to install and manage Firebase dependencies.

  1. In Xcode, with your app project open, navigate to File > Swift Packages > Add Package Dependency.
  2. When prompted, add the Firebase Apple platforms SDK repository:
  3.   https://github.com/firebase/firebase-ios-sdk
      
  4. Select the SDK version that you want to use.
  5. Choose the Firebase libraries you want to use.

    If Google Analytics is enabled in your Firebase project, make sure to add FirebaseAnalytics. For Analytics without IDFA collection capability, add FirebaseAnalyticsWithoutAdId instead.

When finished, Xcode will automatically begin resolving and downloading your dependencies in the background.

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:

    Swift

    import Firebase

    Objective-C

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

    Swift

    // Use Firebase library to configure APIs
    FirebaseApp.configure()

    Objective-C

    // Use Firebase library to configure APIs
    [FIRApp configure];
  3. If you've included the Firebase SDK for Google Analytics, you can run your app to send verification to the Firebase console that you've successfully installed Firebase.

That's it! You can skip ahead to the next steps.

If you're having trouble getting set up, though, visit the Apple platforms troubleshooting & FAQ.

Available libraries

This section lists the Firebase products supported for Apple platforms. Learn more about these Firebase Apple platform libraries:

Service or Product Pods SwiftPM Libraries Add Analytics?
AdMob pod 'Google-Mobile-Ads-SDK' N/A
Analytics pod 'Firebase/Analytics' FirebaseAnalytics
App Check pod 'Firebase/AppCheck' FirebaseAppCheck
App Distribution pod 'Firebase/AppDistribution' FirebaseAppDistribution
Authentication pod 'Firebase/Auth' FirebaseAuth
Cloud Firestore pod 'Firebase/Firestore' FirebaseFirestore
Cloud Functions for Firebase Client SDK pod 'Firebase/Functions' FirebaseFunctions
Cloud Messaging pod 'Firebase/Messaging' FirebaseMessaging
Cloud Storage pod 'Firebase/Storage' FirebaseStorage
Crashlytics pod 'Firebase/Crashlytics' FirebaseCrashlytics
Dynamic Links pod 'Firebase/DynamicLinks' FirebaseDynamicLinks
In-App Messaging pod 'Firebase/InAppMessaging' FirebaseInAppMessaging
(required)
Firebase installations pod 'Firebase/Installations' FirebaseInstallations
Firebase ML Custom Model APIs pod 'Firebase/MLModelDownloader' FirebaseMLModelDownloader
Performance Monitoring pod 'Firebase/Performance' FirebasePerformance
Realtime Database pod 'Firebase/Database' FirebaseDatabase
Remote Config pod 'Firebase/RemoteConfig' FirebaseRemoteConfig

Integrate without a dependency manager

If you don't want to use Swift Package Manager, you can still take advantage of the Firebase SDKs by importing the frameworks directly or by using CocoaPods.

Frameworks

In addition to supporting the iOS platform, the zip now includes .xcframework files. For details, see the Firebase Apple platforms SDK README on GitHub .

  1. Download the framework SDK zip. This is a ~200MB 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.

CocoaPods

Learn more about CocoaPods integration in our guide.

Next steps

Learn about Firebase:

Add Firebase services to your app: