gpt4 book ai didi

ios - FCM 推送通知

转载 作者:行者123 更新时间:2023-11-29 00:21:31 24 4
gpt4 key购买 nike

我正在研究 FCM,但只有下面的方法被调用。

- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
// Print full message
NSLog(@"This is the message whole structure%@", remoteMessage.appData);
NSLocalizedString(@"This is remote message%@", remoteMessage);
NSString * msg = [remoteMessage.appData objectForKey:@"message"];
NSLog(@"msg %@",msg);
[self alertStatus:msg:@"Alert"];
}

而且我只通过上述方法从服务器收到了完整的消息。但是没有调用任何推送通知方法。我没有收到任何推送通知,所以我无法在后台接收通知。

最佳答案

请您的后端服务器开发人员像这样在您的有效载荷中添加notification

{
"to" : " ...",
"notification" : {
"body" : "great match!",
"title" : "Portugal vs. Denmark",
"icon" : "myicon"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}
}

如果你想为用户显示通知,你应该在你的负载中使用 notification 键。

Reference 1

Reference 2

关于ios - FCM 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44109567/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com