Complete Beginners Guide to Setting Up Push Notifications in iOS

Push Notifications are essential for modern apps — whether you're reminding users of a new message, sending a promotional offer, or alerting about important updates. In this blog, we’ll walk you through setting up push notifications for both iOS and Android using Firebase, in a way that even freshers can follow.
Push Notifications are essential for modern apps — whether you're reminding users of a new message, sending a promotional offer, or alerting about important updates. In this blog, we’ll walk you through setting up push notifications for both iOS and Android using Firebase, in a way that even freshers can follow.
What Are Push Notifications?
Push notifications are short messages sent from a server (like Firebase) to a user's device, even when the app is not open. They help keep your users engaged and informed in real-time.
Tools and Services We'll Use
Tool/Service | Description |
Firebase Cloud Messaging (FCM) | Google’s cross-platform messaging solution to send notifications. It's FREE and supports both iOS and Android. |
Xcode | Apple’s official IDE (Integrated Development Environment) for building iOS apps. |
Apple Developer Portal | Platform for managing Apple apps, certificates, and identifiers. Required for enabling push on iOS. |
Keychain Access | A macOS tool for managing digital certificates. Helps generate the certificates required by Apple for push notifications. |
iOS Push Notification Setup
Step 1: Create a Bundle Identifier in Xcode
What is it?
A unique string used to identify your app on the Apple ecosystem (e.g.,com.companyname.appname
)
How to do it:
Open your project in Xcode.
Go to your project in the left navigator.
Select your Target > General tab.
Under Identity, set a Bundle Identifier.
Step 2: Enable Push Capabilities in Xcode
Why?
Push Notifications won’t work unless you explicitly enable the capability in your app project.
Steps:
Go to Signing & Capabilities.
Click “+ Capability”.
Add:
Push Notifications
Background Modes
Check Remote notifications and Background fetch
Step 3: Generate APNs Certificates Using Keychain
What is APNs?
Apple Push Notification service (APNs) is Apple’s system that delivers notifications to iOS/macOS devices.
Why Keychain?
To communicate with APNs, Apple requires a certificate proving your app’s identity.
Steps:
Open Keychain Access (use Spotlight or Launchpad).
Go to:
Keychain Access → Certificate Assistant → Request a Certificate From a Certificate Authority
3. Fill the form:
User Email Address: Your Apple ID
Common Name: e.g., MyApp Push Certificate
Leave CA Email Address empty
Choose “Saved to Disk”
This will generate a .certSigningRequest
file — this file is needed in the Apple Developer portal.
Step 4: Configure Certificates in Apple Developer Portal
Why?
To allow your app to receive push notifications, you must register it and configure certificates on Apple’s platform.
Steps:
Go to Apple Developer Console
Navigate to Identifiers
Click “+” to create a new App ID using your Bundle Identifier
Enable Push Notifications
Then:
Scroll down to Push Notifications
Under both Development and Production, click Configure
Upload the
.certSigningRequest
you createdDownload the resulting
.cer
files
Step 5: Export .p12 Certificates from Keychain
What is a .p12 file?
It’s a secure file format that bundles your push certificate with a private key. Required by Firebase to send notifications via APNs.
Steps:
Double-click downloaded
.cer
files — they’ll be added to KeychainIn Keychain:
Go to My Certificates
Locate both Development and Production certificates
Right-click → Export
Save as- Dev-certificate-FCM.p12
- Prod-certificate-FCM.p12
Step 6: Configure Firebase for iOS
Why Firebase?
Firebase Cloud Messaging (FCM) will act as the server that sends notifications to your iOS and Android devices.
1. Create Firebase Project
Go to Firebase Console
Create a project
Add an iOS app
Use the same Bundle Identifier
Download
GoogleService-Info.plist
Drag this file into your Xcode project’s root folder.
2. Initialize Firebase in Xcode
Add Firebase configuration in your app's startup file:
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
}
3. Upload .p12 Certificates to Firebase
Go to Project Settings > Cloud Messaging
Scroll to your iOS app under APNs Authentication Key
Upload
Dev-certificate-FCM.p12
- Prod-certificate-FCM.p12
Android Push Notification Setup with Firebase
Step 1: Add Firebase to Android App
In Firebase Console, add an Android app
Use your package name (e.g.,
com.xpecto.myapp
)Download
google-services.json
fileAdd this file to the
app/
folder of your Android project
Step 2: Update Gradle Files
In build.gradle (Project)
:
classpath 'com.google.gms:google-services:4.3.15'
In build.gradle (App)
:
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation 'com.google.firebase:firebase-messaging:23.1.0'
}
Step 3: Create a Firebase Messaging Service
Create a custom class to handle incoming messages:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// Handle your push notification logic here
}
}
Also, update your AndroidManifest.xml
to register this service.
Test Push Notifications via Firebase
Go to Firebase Console > Cloud Messaging
Click Send Message
Set a title and body
Target a specific device or app
Click Test
If everything is set correctly, you should receive the notification on your device
Need Help?
At Xpecto® IT Solutions, we help startups and enterprises integrate cloud messaging and real-time features seamlessly. Whether you're building in React Native, Swift, or Kotlin, we can support you from setup to scaling.
Comments