---
title: iOS Notification Images
description: >-
  Create a Notification Service Extension target in Xcode and call the Firebase
  extension helper to show images in iOS push notifications. The CocoaPods
  Firebase recipe for the extension target is not supported on Firebase Apple
  SDK 13+ (SPM-only).
next: /messaging/server-integration
previous: /messaging/notifications
---
> ## Documentation Index
> Fetch the complete documentation index at: https://rnfirebase.io/llms.txt
> Use this file to discover all available pages before exploring further.

## Prerequisites

- `@react-native-firebase/app` and `@react-native-firebase/messaging` installed (`npm install --save @react-native-firebase/app @react-native-firebase/messaging` or `yarn add @react-native-firebase/app @react-native-firebase/messaging`), then `cd ios && pod install`.
- [iOS Messaging Setup](/messaging/usage/ios-setup) completed (Push Notifications, Background Modes, APNs key linked in Firebase Console). From v26, New Architecture is required for packages with a native bridge.
- Xcode `>= 26.2`, iOS deployment target `15.0`, firebase-ios-sdk `13.1.1` (default pin).
- A physical iOS device for end-to-end image notification delivery testing.

This is a quick guide to display an image in an incoming notification. Android handles this out of the box so this extra setup is **only necessary for iOS**.

> If you want to know more about the specifics of this setup read the [official Firebase docs](https://firebase.google.com/docs/cloud-messaging/ios/send-image).

## Supported install path

React Native Firebase iOS builds resolve Firebase through Swift Package Manager (SPM), and Firebase Apple SDK 13+ is SPM-only. See [iOS SPM Support](/ios-spm) for the supported install path and Podfile requirements.

Adding `pod 'Firebase/Messaging'` to a `target 'ImageNotification'` block in the Podfile (with `use_frameworks! :linkage => :static`) is not supported. CocoaPods does not distribute Firebase Apple SDK 13+, and static pod linkage is not allowed with SPM.

This page documents how to create the extension target and the extension code. It does not document how to link `FirebaseMessaging` into the extension target under SPM. React Native Firebase does not verify that setup, so follow the [official Firebase docs](https://firebase.google.com/docs/cloud-messaging/ios/send-image) for it and confirm the result on a physical device.

## Steps

Open Xcode and follow the steps below to add a Notification Service Extension target that can populate rich notification content (including images).

### Step 1 - Add a notification service extension

- From Xcode top menu go to: **File > New > Target...**
- A modal will present a list of possible targets, scroll down or use the filter to select `Notification Service Extension`. Press **Next**.
- Add a product name (use `ImageNotification` to follow along) and click **Finish**
- Enable the scheme by clicking **Activate**

![step-1](/assets/messaging/ios-notification-images-step-1.gif)

### Step 2 - Use the extension helper (Objective-C)

> If you selected to create your extension as a Swift project, jump to the next section.

This step invokes the extension helper. It requires `FirebaseMessaging` to be linked into the `ImageNotification` target (see [Supported install path](#supported-install-path)).

- From the navigator select your `ImageNotification` extension
- Open the `NotificationService.m` file
- At the top of the file import the `FirebaseMessaging` module right after the `NotificationService.h` as shown below

```diff
#import "NotificationService.h"
+ @import FirebaseMessaging;
```

The exact import can depend on how `FirebaseMessaging` is linked into the extension target. If the module import does not resolve in your setup, use the form from the [official Firebase docs](https://firebase.google.com/docs/cloud-messaging/ios/send-image).

- then replace everything from line 25 to 28 with the extension helper

```diff
- // Modify the notification content here...
- self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];

- self.contentHandler(self.bestAttemptContent);
+ [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];
```

![step-2](/assets/messaging/ios-notification-images-step-3.gif)

### Step 2 - Use the extension helper (Swift)

This step invokes the extension helper. It requires `FirebaseMessaging` to be linked into the `ImageNotification` target (see [Supported install path](#supported-install-path)).

- From the navigator select your `ImageNotification` extension
- Open the `NotificationService.swift` file
- At the top of the file import `FirebaseMessaging` right after the `UserNotifications` import as shown below

```diff
import UserNotifications
+ import FirebaseMessaging

class NotificationService: UNNotificationServiceExtension {
```

As with Objective-C, the exact import can depend on how `FirebaseMessaging` is linked into the extension target.

- then replace everything from line 19 to 23 with the extension helper

```diff
        if let bestAttemptContent = bestAttemptContent {
-            // Modify the notification content here...
-            bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
-
-            contentHandler(bestAttemptContent)
+            Messaging.serviceExtension()
+               .populateNotificationContent(bestAttemptContent, withContentHandler: contentHandler)
        }
```

## All done

Run the app and check it builds successfully (**make sure you have the correct target selected**). Use the [Notifications composer](https://console.firebase.google.com/u/0/project/_/notification) to test sending notifications with an image (`300KB` max size). You can also create custom notifications via [`FCM HTTP`](https://firebase.google.com/docs/cloud-messaging/http-server-ref) or [`firebase-admin`](https://www.npmjs.com/package/firebase-admin). Read [messages from a server](/messaging/server-integration) for Admin SDK payload shapes (including `mutable-content` / `imageUrl`).
