检测用户是否开启推送

公司项目需求,这个需要做版本判断,因为iOS7和iOS8以后的判断策略不一样。

mark下

       if (IOS_MORE(8.0))
        {
            //iOS8 later
            if (UIUserNotificationTypeNone == [[[UIApplication sharedApplication] currentUserNotificationSettings] types])
            {
                [self presentNotificationDisableVC];
            }
        }
        else
        {
            //iOS7
            if([[UIApplication sharedApplication] enabledRemoteNotificationTypes] != (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert))
            {
                [self presentNotificationDisableVC];
            }
        }
原文地址:https://www.cnblogs.com/ioshevin/p/4949302.html