iOS获取设置的推送是否打开的方法

来源:互联网 发布:淘宝助理官方网站下载 编辑:程序博客网 时间:2024/06/01 13:19

直接上代码,做个笔记

- (BOOL)isAllowedNotification{    //iOS8 check if user allow notification    if (IOS8_OR_LATER) {// system is iOS8        UIUserNotificationSettings *setting = [[UIApplication sharedApplication] currentUserNotificationSettings];        if (UIUserNotificationTypeNone != setting.types) {            return YES;        }    } else {//iOS7        UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];        if(UIRemoteNotificationTypeNone != type) {            return YES;        }    }    return NO;}
0 0
原创粉丝点击