Skip to content

[firebase_messaging]: Image notification not working in iOS #17456

Open
@ciprianteletin

Description

@ciprianteletin

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

iOS

Description

I am using Firebase messaging on both iOS and Android. Recently, I have upgraded the iOS version to minimum 14, as well as upgrading the packages to the firebase_messaging: 15.1.6 and firebase_core to 3.8.1. I am using currently Flutter 3.27

After the upgrade, I have observed that the Image notification on iOS is no longer working (on Android works as before). I have checked the following:

  • If the certificate is valid. Yes, it is till October
  • If the push notification option is enabled in my Identity: yes it is
  • If I have the NotificationService code written and referenced in the correct place (Podfile), and yes it is there.

I have done no modification on the code compared to the previous releases. Android still works as expected. Text notifications are working fine on both platforms.

Reproducing the issue

Notification service code:
#import "NotificationService.h"
#import "FirebaseMessaging.h"

@interface NotificationService ()
@Property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@Property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@EnD

@implementation NotificationService

  • (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    // Use FIRMessaging's extension helper to handle image attachments.
    [[FIRMessaging extensionHelper] populateNotificationContent:self.bestAttemptContent withContentHandler:contentHandler];
    }

  • (void)serviceExtensionTimeWillExpire {
    // Deliver the best attempt at modified content before time runs out.
    self.contentHandler(self.bestAttemptContent);
    }

@EnD

Notification header:
#import <UserNotifications/UserNotifications.h>

@interface NotificationService : UNNotificationServiceExtension

@EnD

Code from Podfile:
target 'ImageNotification' do
use_frameworks!
pod 'Firebase/Messaging'
end

Firebase Core version

3.8.1

Flutter Version

3.27

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.platform: iosIssues / PRs which are specifically for iOS.plugin: messagingtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions