Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 角标数Badge Number增加问题 #164

Closed
Linspirit98 opened this issue May 30, 2020 · 2 comments
Closed

iOS 角标数Badge Number增加问题 #164

Linspirit98 opened this issue May 30, 2020 · 2 comments

Comments

@Linspirit98
Copy link

官方对badge字段说明如下: 可直接指定 APNs 推送通知的 badge,直接展示在桌面应用图标的右上角,含义是应用未读的消息数。 也支持如 +12,-3 等运算操作,JPush 会针对每一个用户当前的 badge 做单独的运算,例:接受者 A,B 的角标分别为 1 和 2,那么推送 +2 后 A的角标变为 3,B 的角标变为 4。默认值为 1。

我这边测试的时候,如果一开始badge就填+1的话,我的消息就会显示为2,但它其实应该是1。
我打开app之后代码会清除掉角标,之后再发送推送时写badge +1的话,角标又变成了3。
我不知道是我写法问题还是jpush的bug。

我在appdelegate.m的 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
这里写了
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

我在addEventHandler的 onOpenNotification: (Map<String, dynamic> message) async 里也写了jpush.clearAllNotifications(); // 清除角标

这两种方式也尝试了。还是不行。
[application setApplicationIconBadgeNumber:0];
[application cancelAllLocalNotifications];

有人有解决方案吗?
谢谢!

@Linspirit98 Linspirit98 changed the title iOS 角标问题 iOS 角标数Badge Number增加问题 May 30, 2020
@cssword
Copy link

cssword commented Jun 10, 2020

#155

这是我的解决方案,需要把resetBadge加上

@Linspirit98
Copy link
Author

#155

这是我的解决方案,需要把resetBadge加上

感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants