iOS - Push Notification: does it always display a notification

陌路散爱 提交于 2019-12-10 12:07:59

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/3172566/ios-push-notification-does-it-always-display-a-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!