简体   繁体   English

是否可以忽略iOS中的一种推送通知

[英]Is it possible to ignore one type of push notification in iOS

The problem is that I want to make ios client responsible for taking care of displaying/not displaying push notification relating on some kind type in push dictionary. 问题是我想让ios客户端负责显示/不显示与推送字典中某种类型有关的推送通知。

I would present some kind of modal view where user can choose what notifications he want to see. 我将提供某种模式视图,用户可以在其中选择他想查看的通知。

And the question is it possible to ignore that chosen type when app is turned off or in background? 问题是,当应用关闭或在后台运行时,是否有可能忽略所选类型?

I know it's bad solution due to unnecessary unwanted pushes to be send and drain battery and it surely should be managed on the server side, but for now I need very fast solution that would be replaced in the future or even there could be double side check. 我知道这是一个糟糕的解决方案,因为它会不必要地发送和消耗电池电量,并且肯定应该在服务器端进行管理,但是现在我需要非常快速的解决方案,将来可以更换它,甚至可能进行双面检查。

No this is not possible, the push notification is handled by the system and not you app. 否,这是不可能的,推送通知是由系统而不是您的应用处理的。

You only option is to use the background refresh with an background fetch push notification. 您唯一的选择是将后台刷新与后台提取推送通知一起使用。 This way you can handle the push notification in the background, and use UILocalNotification to push a notification in the notification center. 这样,您可以在后台处理推送通知,并使用UILocalNotification在通知中心推送通知。

This a has draw back when some one has turned off the background update for your app. 当有人关闭了您的应用程序的后台更新时,这是一个缺点。

The best way is to do it server side, just push the settings to you server and make the decision whether or not to send push notification bast on these settings. 最好的方法是在服务器端进行操作,只需将设置推送到服务器,然后决定是否根据这些设置发送推送通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM