Rich Notification is an enhanced format of iOS push notifications that includes media attachments, interactive buttons, and custom interfaces to improve user experience. Unlike standard text notifications, Rich Notification can display images, videos, and audio directly in the banner or on the lock screen. According to Apple Developer Documentation, 2026, UNNotificationAttachment supports up to 10 files in a single notification and automatically scales them for optimal display on all devices.
Key Takeaways
Rich Notification is an iOS push notification that contains not only text but also media attachments, interactive elements, and a customized interface. The term “rich” reflects the ability to include images, videos, audio, action buttons, and text input in a notification, turning a simple alert into a full-fledged interactive element.
Apple introduced Rich Notification support in iOS 10 along with the UserNotifications framework. Before this, push notifications could only contain text, sound, and a badge. iOS 10 introduced UNNotificationServiceExtension and UNNotificationContentExtension, which opened up the ability to modify content and create custom interfaces. Later versions added SwiftUI support in Content Extension, animated GIFs, and improved media scaling.
Rich Notification significantly increases user engagement. Apple studies show that notifications with images receive 30–40% more interactions compared to text-only ones. A product image, video preview, or quick reply button allows the user to make a decision directly from the notification without opening the app. This shortens the path to the target action and improves the user experience.
UNNotificationAttachment supports three media categories: images, video, and audio. Each type has its own format, size, and duration limitations. The system automatically scales images to fit the notification size and limits video duration to 30 seconds for performance optimization.
| Media Type | Supported Formats | Maximum Size |
|---|---|---|
| Images | JPEG, PNG, GIF, TIFF | 10 MB per file |
| Video | MPEG, MP4, MOV | 10 MB, up to 30 seconds |
| Audio | MP3, AAC, WAV, CAF | 10 MB |
Images are automatically cropped and scaled by the system for display in compact and expanded notification views. Animated GIFs are supported starting from iOS 12 and play automatically when viewing the notification. The recommended image size is 1024x1024 pixels, ensuring sharp display on all devices, including iPad with a large screen.
Video in Rich Notification plays without sound by default — the user can enable sound via the player button. Maximum video duration is 30 seconds, after which playback stops. Audio attachments can be used for voice messages or sound previews and play when tapping the notification in the expanded view.
Interactive actions allow the user to perform operations directly from the notification without opening the app. Actions are registered via UNNotificationCategory and UNNotificationAction when the app launches. Each action can be background (without opening the app) or foreground (opens the app to complete the operation).
UNNotificationAction represents a button with a title and optional modifiers such as requiresAuthentication (requires Face ID/Touch ID) or destructive (highlighted in red). UNTextInputNotificationAction extends this capability by adding a text input field — ideal for quick replies to messages or comments. Actions are displayed on long press on the notification or swipe down.
Notification categories link the content type with a set of available actions. The registration process is performed in AppDelegate at app launch via UNUserNotificationCenter.current().setNotificationCategories. The category is specified on the server in the category field of the JSON payload, and the system automatically applies the corresponding set of actions to the notification.
When the user taps a button or submits text, the system calls the UNUserNotificationCenterDelegate with the didReceive response method. UNNotificationResponse contains the action identifier and the entered text (for UNTextInputNotificationAction). Based on this information, the app executes the corresponding business logic: sends a message, confirms an action, or opens a specific screen.
Let us walk through the full Rich Notification creation cycle: from registering categories in AppDelegate to processing in Service Extension and displaying. AppDelegate registers the category with buttons, the server sends a notification with an image URL, Service Extension downloads the media, and Content Extension displays a custom interface with buttons.
// AppDelegate — registering categories and actions
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
let replyAction = UNTextInputNotificationAction(
identifier: "reply",
title: "Reply",
options: [.authenticationRequired])
let likeAction = UNNotificationAction(
identifier: "like",
title: "Like",
options: [])
let category = UNNotificationCategory(
identifier: "social_post",
actions: [replyAction, likeAction],
intentIdentifiers: [],
options: [])
UNUserNotificationCenter.current()
.setNotificationCategories([category])
return true
}
After receiving a push notification with the “social_post” category and an image URL in a custom field, the Service Extension is activated. The extension downloads the image from the network, creates a UNNotificationAttachment with a unique identifier, and adds it to the content. It is important to check the size of the downloaded file — if it exceeds 10 MB, the attachment will not be created, and the system will show the notification without media.
class NotificationService: UNNotificationServiceExtension {
override func didReceive(
_ request: UNNotificationRequest,
withContentHandler contentHandler:
@escaping (UNNotificationContent) -> Void
) {
let content = (request.content.mutableCopy()
as! UNMutableNotificationContent)
guard let urlString = content.userInfo["media-url"]
as? String,
let url = URL(string: urlString)
else { contentHandler(request.content); return }
URLSession.shared.downloadTask(with: url) {
location, _, _ in
guard let location = location else {
contentHandler(content); return }
let attachment = try! UNNotificationAttachment(
identifier: "media", url: location,
options: [UNNotificationAttachmentOptionsTypeHintKey:
"jpg"])
content.attachments = [attachment]
contentHandler(content)
}.resume()
}
}
To test Rich Notification without a server, use the iOS simulator and send pushes via terminal using xcrun simctl push. In the payload, be sure to specify mutable-content: 1 to activate the Service Extension and the category to display actions. The command fires a push from a JSON file directly to the selected simulator, allowing quick iteration without setting up server infrastructure.
UNNotificationContentExtension allows you to completely replace the standard notification interface with a custom UIKit or SwiftUI view. The extension activates when the user expands the notification (force touch or swipe down) and can contain buttons, sliders, animations, and any other UI components. The interface size adapts to the content using Auto Layout.
Content Extension is based on a storyboard with a view controller inheriting UIViewController. SwiftUI View is integrated via UIHostingController starting from iOS 16, allowing modern approaches to interface building. For backward compatibility with iOS 14–15, it is recommended to use UIKit with xib files. The interface receives modified content from Service Extension via UNNotificationContent.
Content Extension implements the UNNotificationContentExtension protocol with the didReceive response method. UNNotificationResponse contains information about the pressed button or entered text. The extension can update the interface without closing the notification or call the completion handler to close it. This allows creating quick interaction scenarios, such as a “like” with visual feedback directly in the notification.
Apple recommends keeping Content Extension concise and functional, avoiding excessive elements. The maximum height of the expanded notification is about 400 points, after which content scrolls. Use system fonts and spacing for consistency with other notifications. Test on different screen sizes to ensure the interface displays correctly on both iPhone and iPad.
Frequently Asked Questions
The maximum size of a single media attachment is 10 MB. If the limit is exceeded, UNNotificationAttachment is not created, and the notification is displayed without media. It is recommended to optimize images to 1–3 MB for fast loading in Service Extension.
Rich Notifications are supported on all devices with iOS 10 and later, including iPhone 5s and newer. Content Extension with custom UI is available from iOS 12. SwiftUI in Content Extension — from iOS 16. On older versions, the notification displays in standard form.
Yes, animated GIFs are supported starting from iOS 12. GIF is loaded via UNNotificationAttachment as a regular image and automatically plays when viewing the notification. The GIF size is limited to the same 10 MB as other formats.
Maximum 4 actions per notification when registering a category. If more are specified, the system displays the first 4 and ignores the rest. It is recommended to use 2–3 buttons for optimal UX — too many options overload the interface.
Yes, the server must send pushes via APNS (Apple Push Notification service) with a JSON payload containing the media file URL in a custom field and the mutable-content: 1 flag. The server also specifies the category to activate the Content Extension and actions.
Summary
We will develop a mobile application turnkey
IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.
Read also