iOS的推送通知中的多行标题 [英] Multi line title in push notification for iOS

查看:419
本文介绍了iOS的推送通知中的多行标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将FCM集成到同时具有iOS和Android版本的应用程序中.

I'm integrating FCM for an app which has both iOS and Android version.

当前,对于iOS,我想多行发送标题.我该怎么做呢?我正在尝试使用Firebase控制台进行测试.但是对我来说似乎没有任何作用.

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.

我尝试过这些

\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).

这些是通知的属性,因为iOS 10在 UN(Mutable)NotificationContent 上进行了设置>(字幕行之前不可用).

These are properties of a notification, since iOS 10 set on UN(Mutable)NotificationContent (subtitle line is not available before).

可以在通过APNS发送的有效负载中配置它们的属性:

They properties can be configured in the payload sent via APNS:

{
  "aps": {
    "alert": {
      "title": "Custom title",
      "subtitle": "Custom subtitle",
      "body": "Custom message"
    }
  }
}

此外,您可以创建UserNotificationServiceExtension来更新已收到通知的上述属性.

Also, you can create a UserNotificationServiceExtension to update the above properties of a notification that has been received.

这篇关于iOS的推送通知中的多行标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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