iOS Push Notification Setup Guide
Push notifications on iOS are managed through Apple Push Notification service (APNs) — Apple’s official service for delivering remote notifications to iOS devices.
This guide provides a comprehensive walkthrough for setting up push notifications in your iOS application. You’ll learn what each required item means, how to obtain it, and how to configure your app and backend services to send and receive push notifications using Apple Push Notification service (APNs).
Required Items & What They Mean
Item | Description |
---|---|
Developer Team ID | Unique identifier for your Apple Developer account. |
App Bundle ID | The unique identifier for your iOS app. |
Mode | Whether the app is in development (dev ) or production (prod ) mode. |
APNs Key ID | Identifier for your APNs authentication key used to sign push payloads. |
APNs Key File | A .p8 file used for authenticating with APNs using token-based auth. |
1. Developer Team ID
What is it?
Your Developer Team ID is a unique 10-character identifier assigned to your Apple Developer account.
How to Find It:
- Go to Apple Developer Account.
- Log in with your Apple ID.
- Click on Membership.
- Under the Team Information section, find your Team ID.
Example:
AB123CD456
2. App Bundle Identifier
What is it?
The Bundle Identifier is a reverse-DNS string (e.g., com.example.myapp
) that uniquely identifies your app.
How to Set It:
- Open your Xcode project.
- Select the project in the Project Navigator.
- Under Targets > Your App > General, find the Bundle Identifier field.
- Make sure it matches exactly with what you use in the Apple Developer portal.
Note: This must be exactly the same when creating provisioning profiles and push certificates.
3. Mode (Development or Production)
What is it?
This defines whether your app is running in:
- Development mode (debug builds, test devices, sandbox APNs)
- Production mode (release builds, App Store, production APNs)
Why It Matters:
- APNs uses different endpoints for dev and prod.
- Your APNs Key will be the same, but the APNs endpoint changes.
Mode | APNs Endpoint |
---|---|
Development | https://api.sandbox.push.apple.com |
Production | https://api.push.apple.com |
4. APNs Key ID (Auth Key Identifier)
What is it?
The APNs Key ID is the ID of the .p8 key file used for token-based authentication with APNs.
How to Create It:
- Go to Apple Developer Account → Keys.
- Click the ➕ (plus) button to create a new key.
- Enter a name (e.g.,
Push Notification Key
). - Select the Apple Push Notification service (APNs) checkbox.
- Click Continue and then Register.
- Download the
.p8
key file and store it securely.
Once created, you can’t download the file again.
Save the following:
- Key ID (e.g.,
1A2BC3D4E5
) - Team ID
- .p8 File (e.g.,
AuthKey_1A2BC3D4E5.p8
)
5. APNs Key File (.p8)
What is it?
This is the private key file (in .p8
format) used to sign JWTs for push notification authentication.
Important Notes:
- This is used in token-based authentication, replacing older certificate-based auth.
- One APNs key can be used for multiple apps.
- You’ll use this file server-side to generate JWT tokens and authenticate your push requests to APNs.
Xcode & Capability Setup
- Open your project in Xcode.
- Go to your target > Signing & Capabilities.
- Click + Capability and add Push Notifications.
- Also add Background Modes > enable Remote notifications.