iOS 极光服务器角标未清0问题

mahong125
8年前 1.4k 0

您好,我想请问下,我在 app进入后台后调用重置服务器角标的方法,但是下次推送的时候 web 端填写 +1,app本地显示的角标数量是在上次的基础上累加的,在didReceiveRemoteNotification方法中打印出 badge数量 也是累加的数目,重置服务端角标数量代码如下,使用的 sdk 是3.0.2,麻烦看下是什么问题,谢谢。

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

    [JPUSHService resetBadge];/** 重置极光服务器角标为0 */
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];//apple自己的接口,变更应用本地(icon)的badge值;
}

1个回答

热门排序
  • iOS进入后台将断开与服务器的连接。因此api调用是不成功的。

    你可以debug看该api调用后是否有返回success

gptbots-widget