推送通知警报文本的最大长度是多少? [英] What is the maximum length of a Push Notification alert text?

查看:215
本文介绍了推送通知警报文本的最大长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS推送通知的提醒文字的最大长度是多少?

What is the maximum length of the alert text of an iOS push notification?

文档指出通知有效负载必须是下总共256个字节,但肯定必须有警报文本的特定字符的限制。

The documentation states that the notification payload has to be under 256 bytes in total, but surely there must be a specific character limit for the alert text.

推荐答案

在实际用于限制警报文本没有记录在任何地方。
唯一的事情documentation说是:

The real limits for the alert text are not documented anywhere. The only thing the documentation says is:

在iOS 8的和以后中,最大尺寸允许的通知有效载荷是2千字节; Apple推送通知服务拒绝任何超出此限制的通知。 (在iOS 8和OS X之前,最大有效负载大小为256字节。)

In iOS 8 and later, the maximum size allowed for a notification payload is 2 kilobytes; Apple Push Notification service refuses any notification that exceeds this limit. (Prior to iOS 8 and in OS X, the maximum payload size is 256 bytes.)

这是我能找到的一些实验。

This is what I could find doing some experiments.


  • 警报:在iOS 7之前,警报显示限制为107个字符。更大的消息被截断,你会在显示的消息的末尾得到一个...。在iOS 7中,限制似乎增加到235个字符。如果你超过8行,你的邮件也会被截断。

  • 横幅广告横幅会被截断约62个字符或2行。

  • 通知中心:通知中心的邮件会被截断大约110个字符或4行。

  • 锁屏:相同作为通知中心。

  • Alerts: Prior to iOS 7 the alerts display limit was 107 characters. Bigger messages were truncated and you would get a "..." at the end of the displayed message. With iOS 7 the limit seems to be increased to 235 characters. If you go over 8 lines your message will also get truncated.
  • Banners: Banners get truncated around 62 characters or 2 lines.
  • Notification Center: The messages in notification center get truncated around 110 characters or 4 lines.
  • Lock Screen: Same as notification center.

正如这里提醒的是官方文档中的一个非常好的说明:

Just as a reminder here is a very good note from the official documentation:


如有必要,iOS会截断您的消息,使其适合每种通知传送方式;为了获得最佳效果,您不应截断您的消息。

If necessary, iOS truncates your message so that it fits well in each notification delivery style; for best results, you shouldn’t truncate your message.

这篇关于推送通知警报文本的最大长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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