admin管理员组

文章数量:1278822

My team and I are running into an issue with Firebase Cloud Messaging. We are not receiving data messages when running the app in the foreground, background nor killed state.

We configured the following things:

  • APNs Authentication Key in the Firebase Console.
  • Added the Push Notifications capability in Xcode.
  • Enabled Background Fetch & Remote Notifications Background Modes in Xcode.

Notification Messages work nicely. However, data messages do not trigger any of the FCM Message listeners. at least, not whilst Method Swizzling is enabled. When disabling Method Swizzling like this:

info.plist
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

the data messages are received in the app. However, We do not want to disable method swizzling, as Firebase states that Flutter developers should not do this:

Flutter FCM Apple Integration

We are using the following FCM payload to test:

{
    "message": {
        "token": "{FCM_TOKEN_HERE}",
        "data": {
            "type": "TEST"
        },
        "apns": {
            "payload": {
                "aps": {
                    "content-available": 1
                }
            },
            "headers": {
                "apns-priority": "5"
            }
        }
    }
}

EDIT: The app is using Firebase Messaging 14.8.1

See the details above.

My team and I are running into an issue with Firebase Cloud Messaging. We are not receiving data messages when running the app in the foreground, background nor killed state.

We configured the following things:

  • APNs Authentication Key in the Firebase Console.
  • Added the Push Notifications capability in Xcode.
  • Enabled Background Fetch & Remote Notifications Background Modes in Xcode.

Notification Messages work nicely. However, data messages do not trigger any of the FCM Message listeners. at least, not whilst Method Swizzling is enabled. When disabling Method Swizzling like this:

info.plist
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

the data messages are received in the app. However, We do not want to disable method swizzling, as Firebase states that Flutter developers should not do this:

Flutter FCM Apple Integration

We are using the following FCM payload to test:

{
    "message": {
        "token": "{FCM_TOKEN_HERE}",
        "data": {
            "type": "TEST"
        },
        "apns": {
            "payload": {
                "aps": {
                    "content-available": 1
                }
            },
            "headers": {
                "apns-priority": "5"
            }
        }
    }
}

EDIT: The app is using Firebase Messaging 14.8.1

See the details above.

Share Improve this question edited Feb 24 at 15:35 Bob-Touchwonders asked Feb 24 at 14:54 Bob-TouchwondersBob-Touchwonders 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I've already found the issue myself. It seems that in the past my team chose to use the dart-only initialization of FlutterFire. This, in our case, broke the Firebase Silent Data Messages because the GoogleService-info.plist files were missing.

Reconfiguring FlutterFire (manually) and adding the GoogleService-info.plist solved the problem.

本文标签: Flutter Firebase Cloud Messaging Not Receiving Silent Data Messages on iOSStack Overflow