IOS7, iOS8 the difference between push notifications

Source: Internet
Author: User

Push notification code after the IOS8 version
[[UIApplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsForTypes :(Uiusernotificationtypesound | Uiusernotificationtypealert | Uiusernotificationtypebadge) Categories:nil];
Note the following sentence, in IOS8 to register the push notification must be added [[UIApplication sharedapplication] registerforremotenotifications];
Previous push notification code for the IOS8 version
[[UIApplication Sharedapplication] registerforremotenotificationtypes: (Uiusernotificationtypebadge | Uiusernotificationtypesound | Uiusernotificationtypealert)];
If you want to be compatible with both iOS7 and iOS8, my personal code is as follows:
if ([[[Uidevice Currentdevice] systemversion] floatvalue] >= 8.0)
{
[[UIApplication sharedapplication] registerusernotificationsettings:[uiusernotificationsettings settingsForTypes :(Uiusernotificationtypesound | Uiusernotificationtypealert | Uiusernotificationtypebadge) Categories:nil];
[[UIApplication sharedapplication] registerforremotenotifications];
}
Else
{
[[UIApplication Sharedapplication] registerforremotenotificationtypes: (Uiusernotificationtypebadge | Uiusernotificationtypesound | Uiusernotificationtypealert)];
}
iOS8The horizontal status bar does not display

Workaround: In the plist file, set the View controller-based status bar appearance to No in the Application:didfinishlaunchingwithoptions: Add the following code [ [UIApplication sharedapplication] Setstatusbarhidden:yes Withanimation:uistatusbaranimationnone];
[[UIApplication sharedapplication] Setstatusbarhidden:no Withanimation:uistatusbaranimationnone];
iOS8Horizontal screen when the system is hidden by default. This isiOS8New features

Map friends share share to attention point

IOS7, iOS8 the difference between push notifications

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.