iOS Firebase Integration
This document outlines the basic setup required to connect an iOS application to Firebase. This integration enables services such as Push Notifications, Crashlytics, and Analytics.
📋 Prerequisites
| Requirement | Description |
|---|---|
| ✅ Firebase Account | Create or access via Firebase Console |
| ✅ iOS App in Xcode | An existing iOS project created in Xcode |
🔧 1. Create a Firebase Project
- Go to Firebase Console.
- Click "Add project".
- Enter a project name → Enable Google Analytics (optional).
- Complete the project creation process.
🧩 2. Add Your iOS App to Firebase
- Open your Firebase project in the console.
- In the Project Overview, click the iOS icon.
- Fill in the following:
- iOS Bundle ID: Must exactly match the bundle ID in your Xcode project (e.g.,
com.example.myapp). - App nickname: (Optional) A display name for your app. (e.g.,
MyApp - iOS Internal App) - App Store ID: Leave blank if not applicable.
- iOS Bundle ID: Must exactly match the bundle ID in your Xcode project (e.g.,
- Click Register app.
- Download the GoogleService-Info.plist file.
📥 3. Add GoogleService-Info.plist to Your Project
- Drag the downloaded
GoogleService-Info.plistfile into your Xcode project. - In the popup:
- ✅ Check "Copy items if needed".
- ✅ Ensure your main app target is selected in Add to targets.
This file is required for the Firebase SDK to load your app configuration.
⚙️ 4. Install Firebase SDK
Using Swift Package Manager (Recommended):
- In Xcode, go to File > Add Packages.
-
Enter the URL: https://github.com/firebase/firebase-ios-sdk
-
Select the modules you need:
-
FirebaseAnalytics FirebaseMessaging(for push notifications)FirebaseCrashlytics,FirebaseAuth, etc., as needed.
🚀 5. Initialize Firebase SDK
AppDelegate.swift:
import Firebase
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}