Issues with IOS 8 push registration changed

Source: Internet
Author: User

Soon after, the iphone 6/6 Plus will be springing up all over the country. iOS 8 is already a step ahead, but some developers have noticed a change in how push notifications are registered on iOS 8, with an error message

1 registerForRemoteNotificationTypes: is not supported iniOS 8.0 and later.

After a successful registration with a new solution, a foreign developer found that the iphone 6 still does not work. Given that the iphone 6/6 Plus will be sold domestically, we can take a proactive look ahead.

IOS 8 has changed the way push messages are registered, so there are some changes that need to be made when developing applications that have push requirements. You can then try adding the following piece of code to the Didfinishlaunchingwithoptions method of the APPDELEGATE.M file to avoid problems with the iphone 6/6 Plus:

123456789101112 #ifdef __IPHONE_8_0 //这里主要是针对iOS 8.0,相应的8.1,8.2等版本各程序员可自行发挥,如果苹果以后推出更高版本还不会使用这个注册方式就不得而知了……if([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil];    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];}  else{    UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];}#elseUIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;[[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];#endif

Then add this method to the APPDELEGATE.M:

123456 #ifdef __IPHONE_8_0- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{    [application registerForRemoteNotifications];}#endif

Issues with IOS 8 push registration changed

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: 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.