tags:

views:

1109

answers:

2

I want to set an icon badge while I am not in the application, like the Mail application. How can I do that?

A: 

The iPhone SDK doesn't support that functionality yet. It can only be done on a jailbroken device.

EDIT: Sorry that's not ENTIRELY true, you can do it with the 'push' function but only apps that are screened by Apple are allowed at this stage.

EDIT AGAIN: Nope I'm completely wrong try this

[UIApplication sharedApplication].applicationIconBadgeNumber = 2;
Kane Wallmann
Really? I'm not an iphone developer, but I have a couple of non-jailbroken, non-push apps that set the icon badge.
Ray
You know what, your right... I must have been thinking of something else. Cheers.
Kane Wallmann
+5  A: 

From within your application you can use the applicationIconBadgeNumber property of UIApplication to set the badge number:

[UIApplication sharedApplication].applicationIconBadgeNumber = 1;

If you want to change the badge without the user launching your app, you need to use the push notification service. The Push Notification Service Programming Guide should have all the info you need.

Gordon Wilson