仅针对物理iOS设备不会调用FirebaseMessaging回调(onMessage,onResume,onLaunch)

时间:2020-08-13 07:17:43

标签: ios flutter firebase-cloud-messaging

我正在使用6.0.16版(最新),在android和iOS模拟器中在前台和后台均可按预期方式推送通知,但是在实际的iOS设备中,如果该应用程序在通知托盘中收到通知,已终止或在后台运行,但是我无法捕获单击操作或在消息逻辑上执行。

Here's my flutter doctor summary

[✓] Flutter (Channel master, 1.21.0-10.0.pre.55, on Mac OS X 10.15.6 19G73, locale en-EG)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] Connected device (2 available)

1 个答案:

答案 0 :(得分:0)

1- click_action必须设置为“ FLUTTER_NOTIFICATION_CLICK”

2- click_action必须在有效载荷的数据部分中设置

 DATA='{
 "notification": {
 "body": "this is a body",
"title": "this is a title"
"click_action": "FLUTTER_NOTIFICATION_CLICK",
 },
"data": {
  "sound": "default", 
  "status": "done",
  "screen": "screenA",
},
"to": "<FCM TOKEN>"
}'