iOS - 推送通知:它是否总是显示通知 [英] iOS - Push Notification: does it always display a notification

查看:28
本文介绍了iOS - 推送通知:它是否总是显示通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)

谢谢

推荐答案

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

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.

这篇关于iOS - 推送通知:它是否总是显示通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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