新消息通知

- (void)judge
{
    BOOL isNotifyAlert = NO, isNotifySound = NO;
    if (IOS8)
    {
        UIUserNotificationType types = [[UIApplication sharedApplication] currentUserNotificationSettings].types;
        isNotifyAlert = (types & UIUserNotificationTypeAlert) == UIUserNotificationTypeAlert;
        isNotifySound = (types & UIUserNotificationTypeSound) == UIUserNotificationTypeSound;
    }
    else
    {
        UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
        isNotifyAlert = (types & UIRemoteNotificationTypeAlert) == UIRemoteNotificationTypeAlert;
        isNotifySound = (types & UIRemoteNotificationTypeSound) == UIRemoteNotificationTypeSound;
    }

    NSLog(@"-------------推送开关, 接收:%@, 声音:%@", isNotifyAlert?@"yes":@"no",isNotifySound?@"yes":@"no");

}

 

posted @ 2015-08-24 09:33  caohaozhi  阅读(105)  评论(0编辑  收藏  举报