ios10, Swift 3 and Firebase Push Notifications (FCM)(ios10、Swift 3 和 Firebase 推送通知 (FCM))
问题描述
我很难显示我从 FCM 通知控制台发送到我的设备的推送通知.我可以看到设备正在接收通知,因为我可以看到我发送的消息test8"
I am struggling to display my push notifications that I am sending to my device from the FCM notification console. I can see the device is receiving the notification because I can see the message I send "test8"
但不管我的应用是在前台还是后台,我都不会显示通知.
But it does not matter if my app is in the foreground or background I don't get the notification displayed.
我在 info.plist 中添加了必需的后台模式 - 应用下载内容以响应推送通知".我的证书是正确的,生成令牌没有问题.我的应用正在接收通知,但只是不显示它们.
I have added "Required background modes - App downloads content in response to push notifications" to the info.plist. My certificates are correct and I have no issue generating a token. My app is receiving the notifications but just not displaying them.
我一直在尝试自己研究和解决这个问题,但我遇到了问题.任何帮助或建议将不胜感激.
I having been trying to research and solve this issue on my own but I am having issues. Any help or suggestions would be greatly appreciated.
推荐答案
在didRegisterForRemoteNotificationsWithDeviceToken方法内部,添加如下代码:
Inside method didRegisterForRemoteNotificationsWithDeviceToken, add the following code:
别忘了在Capabilities中启用Push Notifications.
这篇关于ios10、Swift 3 和 Firebase 推送通知 (FCM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!