简体   繁体   English

使用Firebase的iOS推送通知

[英]iOS Push notification using Firebase

I am working in a project where I need to show notifications fired by Firebase. 我在一个项目中需要显示Firebase触发的通知。 Everything works fine with the send and receive flow . send and receive flow一切正常。 But I need to customise the notification before showing it, ie, when the app is in background. 但是我需要在显示通知之前即在应用程序处于后台时自定义通知。 Because the message I receive from our server it's already Base64 encoded . 因为我从服务器收到的消息已经是Base64 encoded And therefore the notification displays a long string that my petrify the users. 因此,通知显示了一个长字符串,我使用户感到僵化。 Is there any delegate or something which I can use to modify the received data before presenting it when the app is in background ? app is in background 时, presenting 接收到的数据之前,是否有任何委托人或我可以用来修改接收到的数据的东西

Currently there is no way in iOS to do that. 目前,iOS中尚无此方法。 Please refer to this answer for more details How to change how a remote notification is presented before presentation? 请参考此答案以获取更多详细信息。 如何在演示之前更改远程通知的显示方式?

You can use these following in your project to handle any data. 您可以在项目中使用以下代码来处理任何数据。

Works only for iOS 10.2 or greater 仅适用于iOS 10.2或更高版本

UNNotificationServiceExtension UNNotificationServiceExtension

UNNotificationContentExtension UNNotificationContentExtension

Go through this link - https://medium.com/@prianka.kariat/ios-10-notifications-with-attachments-and-much-more-169a7405ddaf 通过此链接-https://medium.com/@prianka.kariat/ios-10-notifications-with-attachments-and-much-more-169a7405ddaf

As i have limited time please let me know if you need more explanation on this. 由于时间有限,如果您需要更多说明,请告诉我。

Debugging is also a tricky part in this First you go through this then try to debug by GO to DEBUG -> Attach to process by pid and paste your extension name you added. 调试也是这个过程中的一个棘手部分。首先,您将经历此过程,然后尝试通过GO进行调试以调试->使用pid附加到进程并粘贴您添加的扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM