Skip to content

[IOS] The onMessageReceivedInTheForeground callback triggers multiple times for a single notification #53

@ebabhi

Description

@ebabhi

Issue

When the app is in the foreground and receives a notification, the onMessageReceivedInTheForeground callback is triggered multiple times.

Expected Behaviour

onMessageReceivedInTheForeground should only be triggered once per notification.

Steps to replicate

  1. Set up Pusher Beams on iOS.
  2. Add a callback to onMessageReceivedInTheForeground.
  3. The callback will be triggered multiple times.

Logs from Xcode for a single notification

SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": Optional({
    pusher =     {
        instanceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        publishId = "pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        userShouldIgnore = 1;
    };
}), "title": "DEBUG"]
flutter: {pusher: {userShouldIgnore: true, publishId: pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, instanceId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}}
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": Optional({
    pusher =     {
        instanceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        publishId = "pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        userShouldIgnore = 1;
    };
}), "title": "DEBUG"]
flutter: null
flutter: {pusher: {userShouldIgnore: true, publishId: pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, instanceId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}}
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
flutter: null
flutter: null
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
flutter: null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions