iOS 推送通知中的多行标题 [英] Multi line title in push notification for iOS
问题描述
我正在为具有 iOS 和 Android 版本的应用程序集成 FCM.
目前,对于 iOS,我想在多行中发送标题.我该怎么做呢?我正在尝试使用 Firebase 控制台进行测试.但似乎没有什么对我有用.
我试过这些
<代码>\n<br/>\\n\r\n
如
您看到的第一行粗体是通知标题,第二行是副标题,以及下面的内容(常规字体).
这些是通知的属性,因为 iOS 10 设置了 UN(Mutable)NotificationContent(以前没有字幕行).
可以在通过 APNS 发送的有效负载中配置它们的属性:
<代码>{aps":{警报": {"title": "自定义标题","subtitle": "自定义字幕","body": "自定义消息"}}}
此外,您可以创建一个 UserNotificationServiceExtension 来更新已收到通知的上述属性.
I'm integrating FCM for an app which has both iOS and Android version.
Currently, for iOS, I want to send title in multiple lines. How do I do this? I'm trying out using Firebase console to test. But nothing seems to work for me.
I tried with these
\n
<br/>
\\n
\r\n
as suggested in this post. But nothing really worked.
I basically want the first 2 lines of the notification to be in bold. Any help much appreciated.
The 1st line in bold you see is a notification Title, the second the Subtitle, and the Content underneath (regular font).
These are properties of a notification, since iOS 10 set on UN(Mutable)NotificationContent (subtitle line is not available before).
They properties can be configured in the payload sent via APNS:
{
"aps": {
"alert": {
"title": "Custom title",
"subtitle": "Custom subtitle",
"body": "Custom message"
}
}
}
Also, you can create a UserNotificationServiceExtension to update the above properties of a notification that has been received.
这篇关于iOS 推送通知中的多行标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!