我在flutter应用程序中使用firebase云消息传递时,正在iOS和android中正确接收通知。
问题是,单击通知时,我已经采取了一些措施,如下所示:
void configureFirebase() {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('on message $message');
print(message['data']['nid']);
print(message['data']['type']);
firebaseIn(message['data']['nid'], message['data']['type']);
},
onResume: (Map<String, dynamic> message) async {
print('on resume $message');
print(message['data']['nid']);
print(message['data']['type']);
firebaseOut(message['data']['nid'], message['data']['type']);
},
onLaunch: (Map<String, dynamic> message) async {
print('on launch $message');
print(message['data']['nid']);
print(message['data']['type']);
firebaseOut(message['data']['nid'], message['data']['type']);
},
);
}
这在android上运行正常,但在iOS上却没有。我收到通知,我看到它已打印在日志中,但单击它却无济于事。在iOS中根本不调用firebaseout和firebasein函数,因为它们中有一些print
!
有人可以帮助我,并告诉我为什么它仅在iOS上不起作用。我真的很困惑吗?