Notification iOS with image not showing with FCM
Issue
I want to receive notification with an image from FCM but the image is not display in the notification banner on iOS but work on Android.
Project Files
iOS
Click To Expand
ios/Podfile:
- [ ] I'm not using Pods
- [x] I'm using Pods and my Podfile looks like:
pod 'Firebase/Core', '~> 6.3.0'
pod 'GoogleIDFASupport', '~> 3.14.0'
pod 'Firebase/Messaging', '~> 6.3.0'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
AppDelegate.m:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}
Android
Click To Expand
Have you converted to AndroidX?
- [ ] my application is an AndroidX application?
- [ ] I am using
android/gradle.settingsjetifier=truefor Android compatibility? - [ ] I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/A
android/app/build.gradle:
// N/A
android/settings.gradle:
// N/A
MainApplication.java:
// N/A
AndroidManifest.xml:
<!-- N/A -->
Environment
Click To Expand
react-native info output:
react-native : 0.60.4
- Platform that you're experiencing the issue on:
- [ ] iOS
- **react-native-firebase
- 5.5.6
Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]
- π Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.
I'm also having this problem. After attaching an image to a notification in Firebase, I would have expected the puppy to show up in the notification, but there's only text. Are there any extra steps or iOS code that has to be added to enable this functionality?

This should be something handled automatically by the device. I guess, it would be an SDK version update?
I can see this was implemented back in April for Android but I can't find something similar on iOS
Apparently we need to create an extension -> docs here.
Would be great if react-native-firebase could do this automatically :)
@LuisRodriguezLD Were you able to get that notification service extension set up properly? If so, could you provide some steps?
Yes! I made it work :) Here is what I did:
-
Create a new
Notification Service ExtensionIn Xcode, File -> New -> Target -> Notification Service Extension Name it and save it ( I usedNotificationServiceExtensionbut you can use whatever ) -
This new target will need the pods as well, so in your pod file add
target 'NotificationServiceExtension' do
pod 'Firebase/Messaging', '~> 6.3.0'
end
(Don't forget to pod install)
- Edit your
NotificationService.mfile in theNotificationServiceExtensionfolder, this was created automatically in step 1.
Import RNFirebaseMessaging at the top
#import "RNFirebaseMessaging.h"
And replace
self.contentHandler(self.bestAttemptContent);
with
[[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];
This video can get you started in step 1. This page has instructions on step 3.
If you get stuck let me know. Please note, step 1 automatically adds a deployment target version. Adjust according to your needs.
I am running into some problems.

react: 16.3.1
react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz
react-native-firebase: ~5.4.0
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'Firebase/Core', '~> 5.4.0'
pod 'Firebase/Auth', '~> 5.4.0'
pod 'Firebase/Messaging', '~> 5.4.0'
pod 'Firebase/Storage', '~> 5.4.0'
pod 'Firebase/DynamicLinks', '~> 5.4.0'
Ugh I'm stuck on 5.4.0 and this might have to do with it? https://github.com/firebase/firebase-ios-sdk/pull/1503
Yeah. I highly recommend you upgrade react-native-firebase to 5.5.6 which has the firebase sdk in 6.3.0
Hello π, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.
@LuisRodriguezLD thanks for your solution but I still get some glitch here. When app in background or foreground, my notification display perfectly with image. But when app is open image dose not show. Do you have any solution for that? Thanks for your support
@ThanhQuang1410 Sorry, I do not have a current solution for when the app is open. I am pretty sure it's a very similar approach.
I'll try to get an example running today but no promises. Feel free to DM me.
@LuisRodriguezLD Awesome. Did you get a chance to try? I am facing a similar issue on Android as well. When the App is open expandable Notifications don't come, even if it's text. The Notification is received but it's not expandable.
@LuisRodriguezLD Awesome. Did you get a chance to try? I am facing a similar issue on Android as well. When the App is open expandable Notifications don't come, even if it's text. The Notification is received but it's not expandable.
In android handle it by doing notification.android.setLargeIcon(IMAGE_URL); and pass image url as data
Yes! I made it work :) Here is what I did:
- Create a new
Notification Service ExtensionIn Xcode, File -> New -> Target -> Notification Service Extension Name it and save it ( I usedNotificationServiceExtensionbut you can use whatever )- This new target will need the pods as well, so in your pod file add
target 'NotificationServiceExtension' do pod 'Firebase/Messaging', '~> 6.3.0' end(Don't forget to pod install)
- Edit your
NotificationService.mfile in theNotificationServiceExtensionfolder, this was created automatically in step 1.Import RNFirebaseMessaging at the top
#import "RNFirebaseMessaging.h"And replace
self.contentHandler(self.bestAttemptContent);with
[[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];This video can get you started in step 1. This page has instructions on step 3.
If you get stuck let me know. Please note, step 1 automatically adds a deployment target version. Adjust according to your needs.
Π‘an you show an example of your code? When i try to add #import "RNFirebaseMessaging.h" i have error "file not found". Π ow did you modify the AppDelegate.m and AppDelegate.h files?
I use Firebase/Messaging', '~> 6.3.0' and react native 0.59.9
@NikitaPFE there is not actual code besides that, it's just configuration.
file not found could be because you did not install the pods. did you follow step 2? Don't forget you need to pod install
@LuisRodriguezLD
Yes, I did pod install
You do not know whether to remove these methods from the AppDelegate.m?

@NikitaPFE There is no need to remove that code from Appdelegate.m
To resolve file not found error, follow these steps:
Go to NotificationService Target -> Build Settings -> Search Header paths and add ->
$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/messaging
Refer https://github.com/invertase/react-native-firebase/issues/632#issuecomment-359673796 for the same.
Hello π, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
I'm also having this problem. After attaching an image to a notification in Firebase, I would have expected the puppy to show up in the notification, but there's only text. Are there any extra steps or iOS code that has to be added to enable this functionality?
any solution you got for this ?