IOS8 before:
UIApplication *app = [UIApplication sharedapplication];
App.applicationiconbadgenumber = num;
IOS8 and later:
Uiusernotificationsettings *settings = [Uiusernotificationsettings Settingsfortypes:uiusernotificationtypebadge Categories:nil];
[[UIApplication sharedapplication] registerusernotificationsettings:settings];
It needs to be set before it can be done. And, it needs to be noted that iOS8 before, can not take it, iOS8 and later must take it.
So now when you use it again, you need to first determine the system version number:
float Version = [[[Uidevice Currentdevice] systemversion] floatvalue];
if (version >= 8.0) {
Uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes: Uiusernotificationtypebadge categories:Nil];
[[uiapplication sharedapplication] registerusernotificationsettings:settings];
}
iOS Development-Displays the number of messages on the app icon