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.
更多推荐
推送通知警报文本的最大长度是多少?
发布评论