推送通知警报文本的最大长度是多少?

编程入门 行业动态 更新时间:2024-10-11 15:22:44
本文介绍了推送通知警报文本的最大长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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.

更多推荐

推送通知警报文本的最大长度是多少?

本文发布于:2023-11-27 22:18:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639816.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   长度   文本   通知

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!