判断消息推送开关:
BOOL isNotifyAlert = NO, isNotifySound = NO;
if (IsIOS8)
{
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;
}
debugLog(@"-------------推送开关, 接收:%@, 声音:%@", [NSString fromBOOL:isNotifyAlert],[NSString fromBOOL:isNotifySound] );