是否可以发送 APNS 消息而不发送警报消息? (仅数据)

发布于 2024-09-05 13:20:30 字数 83 浏览 3 评论 0原文

我正在计划某种发送密码数据的 APNS 服务。 但我不想让用户的设备在应用程序未运行时发出任何消息警报。

这可能吗?以及如何做到这一点?

I'm planning some kind of APNS service which sends a password data.
But I don't want to make user's device alert any message when the app is not running.

Is this possible? And how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

噩梦成真你也成魔 2024-09-12 13:20:30

如果您传递 null 作为警报的正文,那么它将不会显示消息。
如果您传递 null 作为声音,它将不会发出声音(或振动)。
如果您传递 null 作为徽章,那么它不会显示任何不同的徽章。
然后您可以传递许多用户不知道的自定义字段:)

但是,推送通知不应用于关键数据,因为它们并不总是可靠的。它们被定义为“尽力而为”,甚至可能无法到达您的客户。

If you pass null as the Body of the alert then it will not display a message.
If you pass null as the sound, it will not voice a sound (or vibrate).
If you pass null as the badge, then it won't show any different badge.
And then you can pass many custom fields which the user will not know about :)

However push notifications should not be used for cruicial data since they are not always reliable. They are defined as "best effort" and may not even reach your client.

赠佳期 2024-09-12 13:20:30

请参阅 registerForRemoteNotificationTypes 中的 UIRemoteNotificationType:
如果您没有注册 UIRemoteNotificationTypeAlert,则不会显示任何警报。

See UIRemoteNotificationType in registerForRemoteNotificationTypes:
if you don't register for UIRemoteNotificationTypeAlert, no alert is displayed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文