Before you begin, you need a few things set up in your environment:
- Xcode 10.1 or later
- An Xcode project targeting iOS 8 or later
- Swift projects must use Swift 3.0 or later
- The bundle identifier of your app
- CocoaPods 1.4.0 or later
- For Cloud Messaging:
- A physical iOS device
- An Apple Push Notification Authentication Key for your Apple Developer account
- In Xcode, enable Push Notifications in App > Capabilities
If you don't have an Xcode project already, you can download one of our quickstart samples if you just want to try a Firebase feature. If you're using a quickstart, remember to get the bundle identifier from the project settings, you'll need it for the next step.
Add Firebase to your app
It's time to add Firebase to your app. To do this you'll need a Firebase project and a Firebase configuration file for your app. Visit Understand Firebase Projects to learn more about Firebase projects.
Create a Firebase project
In the Firebase console, click Add project, then select or enter a Project name.
If you have an existing Google Cloud Platform (GCP) project, you can select the project from the Project name dropdown menu. Otherwise, enter a new Project name.
(Optional) Edit the Project ID.
Firebase automatically assigns a unique ID to your Firebase project. Visit Understand Firebase Projects to learn about how Firebase uses the project ID.
Follow the remaining setup steps in the Firebase console, then click Create project (or Add Firebase, if you're using an existing Google project).
Firebase automatically provisions resources for your Firebase project. When the process completes, you'll be taken to the overview page for your Firebase project in the Firebase console.
Now that you have a project, you can add your iOS app to it:
Click Add Firebase to your iOS app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
When prompted, enter your app's bundle ID. It's important to enter the bundle ID your app is using; this can only be set when you add the app to your Firebase project.
Add the Firebase iOS configuration file to your app:
Click Download GoogleService-Info.plist to obtain your Firebase iOS config file (
You can download your Firebase iOS config file again at any time.
Move your config file into the root of your Xcode project. If prompted, select to add the config file to all targets.
After you add the initialization code, run your app to send verification to the Firebase console that you've successfully installed Firebase.
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.
Add the SDK
If you are setting up a new project, you need to install the SDK. You may have already completed this as part of creating a Firebase project.
We recommend using CocoaPods to install the libraries. You can install Cocoapods by following the installation instructions. If you'd rather not use CocoaPods, you can integrate the SDK frameworks directly without using CocoaPods.
If you are planning to download and run one of the quickstart samples, the Xcode project and Podfile are already present, but you'll still need to install the pods and download the GoogleService-Info.plist file. If you would like to integrate the Firebase libraries into one of your own projects, you will need to add the pods for the libraries that you want to use.
If you don't have an Xcode project yet, create one now.
Podfileif you don't have one:
$ cd your-project directory $ pod init
Add the pods that you want to install. You can include a Pod in your
This will add the prerequisite libraries needed to get Firebase up and running in your iOS app, along with Google Analytics for Firebase. A list of currently available pods and subspecs is provided below. These are linked in feature specific setup guides as well.
Install the pods and open the .xcworkspace file to see the project in Xcode.
$ pod install $ open your-project.xcworkspace
Download a GoogleService-Info.plist file from Firebase console and include it in your app.
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 are using a quickstart this has been done for you.
- Import the Firebase module in your
- Configure a
FirebaseAppshared instance, typically in your application's
// Use Firebase library to configure APIs FirebaseApp.configure()
// Use Firebase library to configure APIs [FIRApp configure];
These pods are available for the different Firebase features.
|pod 'Firebase/Core'||Prerequisite libraries and Analytics|
|pod 'Firebase/Messaging'||Cloud Messaging|
|pod 'Firebase/Database'||Realtime Database|
|pod 'Firebase/DynamicLinks'||Dynamic Links|
|pod 'Firebase/RemoteConfig'||Remote Config|
|pod 'Firebase/Performance'||Performance Monitoring|
|pod 'Firebase/Firestore'||Cloud Firestore|
|pod 'Firebase/Functions'||Cloud Functions for Firebase Client SDK|
|pod 'Firebase/MLVision'||ML Kit vision APIs|
|pod 'Firebase/MLVisionLabelModel'||ML Kit image labeling model|
|pod 'Firebase/MLVisionBarcodeModel'||ML Kit barcode scanning model|
|pod 'Firebase/MLVisionTextModel'||ML Kit text recognition model|
|pod 'Firebase/MLVisionFaceModel'||ML Kit face detection model|
|pod 'Firebase/MLNaturalLanguage'||ML Kit natural language APIs|
|pod 'Firebase/MLNLLanguageID'||ML Kit language identification model|
|pod 'Firebase/MLNLSmartReply'||ML Kit Smart Reply model|
|pod 'Firebase/MLModelInterpreter'||ML Kit custom model APIs|
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.
- Download the framework SDK zip (this is a ~500MB file and may take some time).
- Unzip and see the
READMEfile for which Frameworks to include in to your project.
- Add the
ObjClinker flag in your
Other Linker Settingsin your target's build settings.
Learn about Firebase:
- Explore sample Firebase apps.
- Get hands-on experience with the Firebase iOS Codelab.
- Explore the open source code in GitHub.
Add Firebase features to your app: