IOS 8 Notification Settings page does not find an issue with the app

Source: Internet
Author: User

Running with XCODE6 will find log hint: Registerforremotenotificationtypes:is not supported in IOS 8.0 and later

IOS 8 have changed notification registration in a non-backwards compatible the. While your need to support IOS 7 and 8 (and while apps built with the 8 SDK aren ' t accepted), you can check for the Selecto RS need and conditionally call them correctly for the running version.  Here's a category on uiapplication that'll hide this logic behind a clean interface for you that'll work in both Xcode 5 and Xcode 6

Workaround:

// ios8 
if  ([[[uidevice currentdevice] systemversion] floatvalue]  >= 8.0)  {
    [[UIApplication sharedApplication]  registerusernotificationsettings:[uiusernotificationsettings 
      Settingsfortypes: (uiusernotificationtypesound | uiusernotificationtypealert |  Uiusernotificationtypebadge)       
Categories:nil]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
   //original code
    [[UIApplication  Sharedapplication] registerforremotenotificationtypes:
      ( Uiusernotificationtypebadge | uiusernotificationtypesound | uiusernotificationtypealert)];
}

Originally in IOS7   The method to determine if push is open is:

{
Uiremotenotificationtype types = [[UIApplication sharedapplication] enabledremotenotificationtypes];
Return (types & Uiremotenotificationtypealert);

}

In IOS8, use the following code:

{
Uiremotenotificationtype types;
if ([[[[Uidevice Currentdevice] systemversion] floatvalue] >= 8.0) {

types = [[UIApplication sharedapplication] currentusernotificationsettings].types;

} else {
types = [[UIApplication sharedapplication] enabledremotenotificationtypes];
}
Return (types & Uiremotenotificationtypealert);

}

IOS 8 Notification Settings page does not find an issue with the app

Related Article

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.