判断消息推送开关:
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] );

本文介绍了如何在iOS应用中检查用户的远程通知(消息推送)设置,以确保应用能够正确接收和处理推送消息。
最低0.47元/天 解锁文章
1422

被折叠的 条评论
为什么被折叠?



