您的位置:首页 > 移动开发 > IOS开发

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

2016-01-27 11:22 459 查看
直接上代码,做个笔记

- (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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios