iOS - 推送通知:是否始终显示通知

发布于 2024-09-08 06:31:02 字数 96 浏览 3 评论 0原文

我想知道是否可以通过 APNS 发送推送通知,并且在应用程序未启动时不显示通知? (在这种情况下,收到的消息将被丢弃)

Thx

I'd like to know if it is possible to send a push notification, through APNS, without displaying a notification if the application isn't started? (in this case, the message received will be thrown away)

Thx

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

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

发布评论

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

评论(1

风追烟花雨 2024-09-15 06:31:02

我可能误解了您的问题,但我假设您是在问如何为用户提供关闭推送通知特定方面的选项?

您必须在应用程序中进行设置。也就是说,如果用户希望关闭此特定方面,您的应用程序将必须向他们发送请求。

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types

因此,如果您仍想使用徽章,但不再显示警报:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge];

请不要忘记将令牌重新发送给您的提供商,因为在此请求后令牌可能已更改。

I may be misunderstanding your question, but I am assuming you are asking how to provide the user with options to turn off particular aspects of the push notification?

You will have to set this in the App. That is, if the user wishes to turn off this particular aspect, your App will have to send up the request for them.

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types

So, if you still wanted to do badges, but no longer show alerts:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge];

Don't forget to resend the Token to your provider as it may have changed after this request.

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