iPhone:通过本地通知增加应用程序徽章 [英] iPhone: Incrementing the application badge through a local notification

查看:153
本文介绍了iPhone:通过本地通知增加应用程序徽章的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在应用程序未运行时通过本地通知递增应用程序徽章?



我知道如何设置徽章,但没有找到


更新:我发现了一个(远不是完美的)解决方案。



例如:

$ b $

如果用户未打开应用程序并为每个+1事件添加通知, b

  • 对于第1天:Count = 0

  • 对于第2天:localNotification.applicationIconBadgeNumber = 1;

  • 对于第3天:localNotification.applicationIconBadgeNumber = 2;

  • 对于第4天:localNotification.applicationIconBadgeNumber = 3;



==>



但是,我正在寻找一个比这个解决方案更好的解决方案。

解决方案

当应用程序不运行时,您将能够动态设置标记号的唯一方法是使用推送通知。您必须在服务器端跟踪更新。


is it possible to increment the application badge through a local notification while the app is not running?

I know how to set the badge, but haven't found any way to increment this value.

localNotification.applicationIconBadgeNumber = 23;

Update: I found a (far from being perfect) solution. You can predict what will happen, if the user doesn't open the app and add notifications for every +1 event.

An example:

  • For day 1: Count = 0
  • For day 2: localNotification.applicationIconBadgeNumber = 1;
  • For day 3: localNotification.applicationIconBadgeNumber = 2;
  • For day 4: localNotification.applicationIconBadgeNumber = 3;

==> Put these notifications in an array and set them before the application exits.

However, I'm searching for a better solution than this workaround.

解决方案

The only way you're going to be able to dynamically set the badge number when your application isn't running is with push notifications. You'll have to track the updates on the server side.

这篇关于iPhone:通过本地通知增加应用程序徽章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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