iPhone:自动增加徽章计数器
可能的重复:
推送通知徽章自动递增。
我已经为我的 iPhone 应用程序实现了推送通知。每当我收到消息时,我都想将徽章值加一,这样我就不需要在推送通知负载中传递它。是否可以?
从这里我了解到我必须从服务器端管理它,所以这是唯一的方式?我必须将以前的值存储在数据库中,并在发送下一条消息时获取最后一个值? Apple 不是自动支持这一点,就像每当收到推送通知时递增 application.applicationIconBadgeNumber 一样。
从服务器端管理徽章号码的问题是,如果用户已经看到之前的推送通知消息,您将发送错误的徽章号码!
Possible Duplicate:
Push-Notification Badge auto increment.
I have implemented Push Notification for my iPhone application. Whenever I get the message, I want to increment badge value by one so I need not to pass it in Push Notification payload. Is it possible?
From here I learnt that I have to manage that from server side, so that's the only way? I had to store the previous value in Database and get the last value whenever I send next message? Isn't Apple support this automatically like incrementing application.applicationIconBadgeNumber whenever Push Notification received.
The problem with managing Badge number from server side is if user has already seen the previous Push Notification message, you would send wrong badge number!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不是什么问题。客户端只需要让服务器知道它看到了什么消息。其他人都在做,所以只要学会如何做并做就可以了。
编辑:您可以使用以下方式设置徽章计数器:
每次设置时,您都应该将
badgeCount
发送到服务器,以便服务器知道当前计数。It's not really a problem. The client just needs to let the server know what messages it has seen. Everyone else is doing it, so just learn how to do it and do it.
EDIT: You can set the badge counter using:
Every time you do, you should send
badgeCount
to the server, so that the server knows the current count.