推送通知在iOS 9中不起作用 [英] Push notifications are not working in iOS 9

查看:85
本文介绍了推送通知在iOS 9中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将设备升级到iOS 9,并将Xcode环境升级到7.0 测试版.推送通知在iOS 9中不起作用?

I have upgraded my devices to iOS 9 and my Xcode environment to 7.0 beta. Push notifications are not working in iOS 9?

这是我的代码:

  float ver = [[[UIDevice currentDevice] systemVersion] floatValue];

    if(ver >= 8 && ver<9)
    {
        if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
        {
            [[UIApplication sharedApplication] registerForRemoteNotifications];
            UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
            [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

        }
    }else if (ver >=9){

        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

        [[UIApplication sharedApplication] registerForRemoteNotifications];


    }
    else{
        //iOS6 and iOS7 specific code
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert];
    }

在使用Xcode 6.4构建的iOS 8至8.3上,推送通知工作正常.

Push notifications are working fine on iOS 8 to 8.3 built with Xcode 6.4.

推荐答案

在项目中添加code并创建证书和即席配置文件-

*Just enable this from your X-code*

*Just enable this from your X-code*

了解更多详细信息- iOS 9 Push Notification Tutoriyal

这篇关于推送通知在iOS 9中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆