iOS推送通知中的粗体(或其他格式) [英] bold (or other formatting) in iOS push notification

查看:162
本文介绍了iOS推送通知中的粗体(或其他格式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内置消息应用程序以推送通知粗体生成消息发送者的姓名。

The built-in Messages app makes message-senders' names in push notifications bold.

是否可以为我执行此操作应用程序吗?这样的有效载荷会是什么样的?

Is it possible to do this for my app? What would such a payload look like?

如果它是相关的,我正在测试使用Mac app APN Tester向我的iPhone发送推送,这种类型的有效载荷 {aps:{alert:hey bob,badge:2}}

If it's relevant, I'm testing using the Mac app APN Tester to send a push to my iPhone, with this type of payload {"aps": {"alert": "hey bob", "badge": 2}}.

(我试过星号 * text * 和HTML标签< b> text< / b> 但他们不喜欢什么都做。我似乎无法找到它的文档。)

(I tried asterisks *text* and HTML tags <b>text</b> but they don't do anything. I can't seem to find documentation on it, either.)

推荐答案

没有富文本功能iOS推送通知。

There is no rich text functionality in iOS Push Notifications.

iOS 8.2 plus的另一种选择可能是使用'title'来显示发件人的姓名,并将新邮件放在正文中。例如,尝试这样的有效负载:

An alternative for iOS 8.2 plus may be to use the 'title' to display the sender's name, and place the new message in the body. For example, try a payload such as this:

{
    "aps": {
        "alert": {
            "title": "Jim",
            "body": "Hey bob"
        },
        "badge": 2
    }
}

这篇关于iOS推送通知中的粗体(或其他格式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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