IOS7:
[OBJC]View Plaincopy
- UIApplication *app = [uiapplication sharedapplication];
- upper right corner of application number
- App. applicationiconbadgenumber = 99;
The code above can handle it.
IOS8:
Setting application badge value in IOS8 will throw the wrong: attempting to badge the application icon but haven ' t received permission from the user To badge the
The reason is because in iOS8, setting the app's application badge value needs to be licensed by the user. Use the following method to inquire whether the user is permitted to apply Settings application badge value
Uiusernotificationsettings *settings = [settingsfortypes:Categories:Nil];
[[registerusernotificationsettings:settings];
Before this to determine whether the system is iOS8 system, or 8 before the system will error.
[OBJC]View Plaincopy
- uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:uiusernotificationtypebadge< Span class= "VARs" > categories:nil];
-
- [[uiapplication Sharedapplication]&NBSP;REGISTERUSERNOTIFICATIONSETTINGS:SETTINGS];&NBSP;&NBSP;
-
- uiapplication *app = [uiapplication&NBSP;SHAREDAPPLICATION];&NBSP;&NBSP;
- // application the upper-right corner number
- app.applicationiconbadgenumber = 0;&NBSP;&NBSP;
Note: To clear a number, set the number to 0
App top right corner number