2015-05-06 34 views

回答

8

夫特

UIApplication.sharedApplication().applicationIconBadgeNumber = 0

目標C

[UIApplication sharedApplication].applicationIconBadgeNumber = 0;

UPDATE

讓PARSE知道它有復位計數器做以下(這也是在設備上重置本地徽章計數):

PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 
if (currentInstallation.badge != 0) { 
    currentInstallation.badge = 0; 
    [currentInstallation saveEventually]; 
} 
+1

我在我的appDelegate didFinishLaunchingWithOptions和應用程序didBecomeActive中執行此操作,並且此操作暫時有效,但如果我收到新通知,應用程序徽章不會按預期讀取1,而是將1添加到以前的徽章編號中已被清除。有關於此的任何信息? – user2363025

+0

也有同樣的問題 – moonvader

3
PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 
currentInstallation.badge = 0; 
[currentInstallation saveEventually]; 

試試這個。

上面提到的代碼會更改應用程序的徽章數量,但不會在服務器上更新它。所以當應用程序收到新的通知時,以前的徽章號碼會增加。

相關問題