cordova,Firebase,FCM插件 - 未在iOS上的通知栏中显示通知 [英] cordova, Firebase, FCM Plugin - Not showing notifications in notification bar on iOS

查看:648
本文介绍了cordova,Firebase,FCM插件 - 未在iOS上的通知栏中显示通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个带有cordova的插件: cordova-plugin-fcm to让通知正常工作。

I'm using this plugin with cordova: cordova-plugin-fcm to get notifications working.

在Android上运行良好。

It works good on Android.

问题出在iOS上,当应用程序在前景通知到达。但是当应用程序关闭或在后台时,通知不显示在通知栏中,但是当我打开应用程序时,我可以看到通知到达并且我生成的弹出窗口被打开。

Problem is with iOS, when the app is in foreground the notifications arrives. But when the app is closed or in background, the notification doesn't show in notification bar, but when I open the application I can see the notification arriving and the popup I generate, gets opened.

但我真的需要通知在锁定屏幕和通知栏中显示。

But I really need to notification to show in lock screen and in the notification bar.

这是我发送给Firebase API的内容:

This is what I'm sending to Firebase API:

/ POST到https://fcm.googleapis.com/fcm/send

在我发送的内容中:

{
  "to" : <USER_TOKEN>,
  "alert":"Test",
  "notification": {
    "alert":"Test test",
    "title": "Notification test",
    "text": "Testing notification text"
  },
  "priority": 10,
  "content_available": true
}

我也试过priority:high并获得相同的结果。

I've also tried with "priority": "high" and get the same results.

通知到达,但它仅在我打开应用程序时显示。我甚至没有在通知栏或锁屏中看到它。

The notification arrives, but it only shows when I open the app. I don't even get it in the notification bar or lock screen.

我还尝试添加aps身体内的财产,里面的所有信息都不起作用。

Also I tried adding the "aps" property in the body, with all the information inside.. doesn't work.

我希望有人可以为此提供一些启示......

I hope someone can throw some light into this..

PS: iOS v10.1.1

PS2:适用于所有Android设备。

PS2: Works good on all android devices.

我已经从社区中读到了一些答案,但似乎没有用:

I've already read some answers from the community but doesn't seem to work:

Firebase API在使用API​​时未发送推送通知

iOS未通过API发送Firebase推送通知

感谢您的时间。

推荐答案

让你上传你的在console.firebase.google.com上开发APNs证书,

have you Upload your Development APNs certificate on console.firebase.google.com,

将您的APNs证书上传到Firebase。如果您还没有APNs证书,请参阅配置APNs SSL证书。

Upload your APNs certificate to Firebase. If you don't already have an APNs certificate, see Provisioning APNs SSL Certificates.

在Firebase控制台的项目内,选择齿轮图标,选择项目设置,然后然后选择Cloud Messaging选项卡。
选择开发证书,生产证书或两者的上载证书按钮。至少需要一个。
对于每个证书,请选择.p12文件,并提供密码(如果有)。确保此证书的软件包ID与应用程序的软件包ID相匹配。选择保存。

Inside your project in the Firebase console, select the gear icon, select Project Settings, and then select the Cloud Messaging tab. Select the Upload Certificate button for your development certificate, your production certificate, or both. At least one is required. For each certificate, select the .p12 file, and provide the password, if any. Make sure the bundle ID for this certificate matches the bundle ID of your app. Select Save.

您可以参考链接 https://firebase.google.com/docs/cloud-messaging/ios/client

这篇关于cordova,Firebase,FCM插件 - 未在iOS上的通知栏中显示通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆