小编Igo*_*aev的帖子

如何在Parse中重置iOS推送通知徽章编号?

我正在使用Parse iOS SDK.我在重置徽章计数时遇到问题.我正在使用教程(解析)代码发送推送通知.我使用增量徽章,但徽章计数继续递增.我正在重置applicationDidBecomeActive中的徽章计数:这样的方法,

- (void)applicationDidBecomeActive:(UIApplication *)application { 

    PFInstallation *currentInstallation = [PFInstallation currentInstallation];

    if (currentInstallation.badge != 0) {
        currentInstallation.badge = 0;
        [currentInstallation saveEventually];
    }

// ...
}
Run Code Online (Sandbox Code Playgroud)

它只是在本地重置徽章编号.但是当我下次发送推送通知时,它只是增加先前的计数值并显示它.我猜Parse服务器中的徽章编号没有被重置.此外,我试图使用[currentInstallation saveInBackground];,但它也没有工作.救命

objective-c push-notification ios parse-platform xcode6

5
推荐指数
1
解决办法
1235
查看次数