Introduction
Push notifications are a critical feature for modern mobile applications, providing real-time alerts,
updates, and improved user engagement. While Android uses Firebase Cloud Messaging (FCM), iOS
uses Apple Push Notification Service (APNS).
This article provides a complete, step-by-step guide to implementing APNS-based push notifications in
a .NET MAUI iOS application.
Overview of .NET MAUI
.NET MAUI (Multi-platform App UI) is a framework for building cross-platform, native applications using
C#. It supports:
- iOS
- Android
- Windows
- macOS
- Single project structure
- Native performance
- Unified APIs
Push notification implementation is platform-specific. This article focuses only on iOS.
Prerequisites
Before starting, ensure you have:
- macOS with Xcode installed
- .NET 8 or later
- Visual Studio 2022
- An Apple Developer account (paid)
- A physical iPhone (push notifications do NOT work on iOS simulators)
- A .NET MAUI project
- Apple Developer Certificates + App ID + Provisioning Profile
Step 1: Create App ID in Apple Developer Portal
- Go to https://developer.apple.com
- Navigate to Certificates, Identifiers & Profiles
- Select Identifiers → App IDs → +
- Choose App
- Enter:
- App Name
- Bundle ID (Example: com.companyname.myapp)
- Under Capabilities, enable:
- Push Notifications
- Save App ID
Step 2: Create Push Notification Key (APNS Key)
- In Apple Developer Portal → Certificates, Identifiers & Profiles
- Go to Keys → +
- Enter a name (e.g., "APNS-Key-MyApp")
- Enable Apple Push Notifications service (APNs)
- Download the generated key: AuthKey_XXXXX.p8
- Save the following:
- Key ID
- Team ID
- Bundle ID
You’ll need these for backend services like Azure Notification Hub or your custom server.
Step 3: Configure Entitlements in MAUI iOS Project
In your MAUI project, open:
Platforms/iOS/Entitlements.plist
Add:
<dict>
<key>aps-environment</key>
<string>development</string> <!-- or production -->
</dict>
Use development while testing.
Step 4: Request Push Notification Permissions
In MauiProgram.cs, add:
builder.Services.AddSingleton<IPushNotificationHandler,
PushNotificationHandler>();
In your app, call:
await Permissions.RequestAsync<Permissions.Notification>();
Step 5: Implement iOS Push Notification Registration
Create or update AppDelegate.cs:
using Foundation;
using UIKit;
using UserNotifications;
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary
options)
{
UNUserNotificationCenter.Current.RequestAuthorization(
UNAuthorizationOptions.Alert |
UNAuthorizationOptions.Badge |
UNAuthorizationOptions.Sound,
(approved, err) => {});
UIApplication.SharedApplication.RegisterForRemoteNotifications();
return base.FinishedLaunching(app, options);
}
public override void RegisteredForRemoteNotifications(UIApplication
application, NSData deviceToken)
{
var token = deviceToken.Description;
token = token.Trim('<', '>').Replace(" ",
"");
Console.WriteLine($"APNS Device Token: {token}");
}
public override void
FailedToRegisterForRemoteNotifications(UIApplication application, NSError
error)
{
Console.WriteLine($"Failed to register:
{error.LocalizedDescription}");
}
}
This registers the device with APNS and retrieves the device token.
Step 6: Handle Incoming Notifications
In AppDelegate.cs, add:
public override void DidReceiveRemoteNotification(UIApplication application,
NSDictionary userInfo,
Action<UIBackgroundFetchResult> completionHandler)
{
Console.WriteLine("Push received: " + userInfo);
completionHandler(UIBackgroundFetchResult.NewData);
}
Step 7: Send a Test Notification
You can send push notifications using:
Option 1: Azure Notification Hub
Use token + APNS key
Option 2: Postman (APNS HTTP/2 API)
POST →
https://api.push.apple.com/3/device/{device_token}
Headers:
authorization: bearer <JWT>
apns-topic: com.companyname.myapp
Body:
{
"aps": {
"alert": {
"title": "Hello iOS",
"body": "This is a test push notification"
},
"sound": "default"
}
}
Step 8: Important Notes for iOS
- Push notifications do not work on iOS simulators
- You must install the app on an actual device
- Proper provisioning profiles are required
- Use correct aps-environment in Entitlements.plist
- Token changes on reinstall; always update it in your backend
Best Practices
- Handle token refresh properly
- Store tokens securely in your backend
- Use silent notifications for background updates
- Follow Apple's UX guidelines for notifications
- Test both development & production environments
Conclusion
Implementing push notifications in .NET MAUI for iOS requires proper configuration of Apple Developer
settings, entitlements, device registration, and handling incoming APNS messages.
Once configured correctly, you can send real-time notifications to your iOS users using APNS, Azure
Notification Hubs, or your own backend.
This detailed guide should help you confidently integrate iOS push notifications into your .NET MAUI
application.
Jasen FiciPosted Oct 21, 2026, 12:54 PM
We picked this up for DotNetNews. Here's the issue: https://dotnetnews.beehiiv.com/p/new-post-5ab1