APNs -未显示警告



我有以下问题,与iPhone上的Apple推送通知服务有关:如果远程通知到达时应用程序正在后台运行,则警报永远不会显示

我知道通知正在到达设备,因为:1)显示徽章或播放声音,如果有效载荷包含任何和2)如果应用程序在前台,方法-application:didReceiveRemoteNotification:userInfo上调用适当的值。

我注意到在设备上的通知设置中,我的应用程序只有徽章声音选项,而其他应用程序也有警报选项。我的猜测是我的应用程序不知何故禁用了警报,但我不知道如何启用它。

任何想法吗?

检查UIRemoteNotificationTypeAlert是否在appDelegate didFinishLaunchingWithOptions或didFinishLaunching方法中注册。

应该是这样的:

 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
 (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | 
  UIRemoteNotificationTypeAlert)];
  • UIRemoteNotificationTypeBadge -启用徽章
  • UIRemoteNotificationTypeSound -启用声音
  • UIRemoteNotificationTypeAlert -启用警报

另一个,不太合理的是,你可能会在你的设备首选项的通知中心禁用"警报"。

最新更新