iOS 8 enabled device not receiving PUSH notifications after code update

后端 未结 8 2494
陌清茗
陌清茗 2020-11-27 03:45

I recently upgraded one of my test iphones to iOS 8 and then upgraded the PUSH registration code as below (using xCode 6)

-(BOOL)hasNotificationsEnabled {

          


        
8条回答
  •  眼角桃花
    2020-11-27 03:48

    The code below resolved:
    
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        UIUserNotificationType types;
        types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;
        if (types & UIUserNotificationTypeAlert)
            pushEnabled=YES;
        else
            pushEnabled=NO;
    }
    else
    {
        UIRemoteNotificationType types;
        types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
        if (types & UIRemoteNotificationTypeAlert)
           pushEnabled=YES;
        else
           pushEnabled=NO;
    
    }
    

提交回复
热议问题