2011-01-25 17 views

Respuesta

18

Puede establecer el número de placa del icono de la aplicación como esta:

[UIApplication sharedApplication].applicationIconBadgeNumber = 3; 
3

Si tienes intención de poner el número de placa a través de mensajes de inserción, se puede enviar el PUSH como:

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

Luego, en su AppDelegate agrega lo siguiente:

- (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];  
} 
Cuestiones relacionadas