简体   繁体   English

iOS推送通知中的多行标题

[英]Multi line title in push notification for iOS

I'm integrating FCM for an app which has both iOS and Android version. 我正在将FCM集成到同时具有iOS和Android版本的应用程序中。

Currently, for iOS, I want to send title in multiple lines. 目前,对于iOS,我想多行发送标题。 How do I do this? 我该怎么做呢? I'm trying out using Firebase console to test. 我正在尝试使用Firebase控制台进行测试。 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. 我基本上希望通知的前2行以粗体显示。 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). 这些是通知的属性,因为iOS 10在UN(Mutable)NotificationContent上设置 (字幕行之前不可用)。

They properties can be configured in the payload sent via APNS: 可以在通过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. 另外,您可以创建UserNotificationServiceExtension来更新已收到通知的上述属性。

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

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