2011-01-25 20 views

cevap

18

Böyle uygulama simgesinin rozeti numarasını ayarlayabilirsiniz:

{"aps":{"alert":"My Push Message","sound":"default","badge",3}} 

: Eğer PUSH mesaj yoluyla rozet numarasını koymak isteyen konum

[UIApplication sharedApplication].applicationIconBadgeNumber = 3; 
3

, siz PUSH gönderebilir Sonra AppDelegate uygulamasında aşağıdakileri ekleyin:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{ 

// This get's the number you sent in the push and update your app badge. 
[UIApplication sharedApplication].applicationIconBadgeNumber = [[userInfo objectForKey:@"badge"] integerValue]; 

// Shows an alert in case the app is open, otherwise it won't notify anything 
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"New Notification!" 
               message:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] delegate:self 
               cancelButtonTitle:@"OK" 
               otherButtonTitles:nil]; 
[alertView show];  
} 
İlgili konular