App top right corner number

Source: Internet
Author: User

IOS7:

[OBJC]View Plaincopy
    1. UIApplication *app = [uiapplication sharedapplication];
    2. upper right corner of application number
    3. 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
    1. uiusernotificationsettings *settings  = [uiusernotificationsettings settingsfortypes:uiusernotificationtypebadge< Span class= "VARs" > categories:nil];  
    2.       
    3. [[uiapplication  Sharedapplication]&NBSP;REGISTERUSERNOTIFICATIONSETTINGS:SETTINGS];&NBSP;&NBSP;
    4.       
    5. uiapplication  *app = [uiapplication&NBSP;SHAREDAPPLICATION];&NBSP;&NBSP;
    6. //  application the upper-right corner number   
    7. app.applicationiconbadgenumber = 0;&NBSP;&NBSP;



Note: To clear a number, set the number to 0

App top right corner number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.