Today is a message notification, to display the number of messages on the icon on the desktop, for example
, the code is also added to the program: [UIApplication sharedapplication].applicationiconbadgenumber = 25;
But what to do is not to show, the last check data found in the iOS8 system must first let the user authorization to display, you can add the following code in the code
if (IS_IOS8) {
Uiusernotificationtype MyType = Uiremotenotificationtypebadge | Uiremotenotificationtypealert | Uiremotenotificationtypesound;
Uiusernotificationsettings *mysetting = [uiusernotificationsettings settingsfortypes:mytype categories:nil];
[[UIApplication sharedapplication] registerusernotificationsettings:mysetting];
}else{
Uiremotenotificationtype MyType = Uiremotenotificationtypebadge | Uiremotenotificationtypealert | Uiremotenotificationtypesound;
[[UIApplication sharedapplication] registerforremotenotificationtypes:mytype];
}
Where Is_ios8 is the macro definition I added, used to determine whether iOS8, the code is as follows:
#define IS_IOS8 ([[Uidevice currentdevice].systemversion Doublevalue] >= 8.0)
This, after restarting the app, will pop up a prompt user authorization prompt box, select OK, so you can display the number of corners on the desktop, and then go to the phone-set inside to see, there will be surprises, set up a lot of our app, such as:
No corner mark issue fixed on iOS app desktop icon