推送通知横幅未显示 - ios9
Pushnotification banner not showing - ios9
我有一个 ios 项目,在从后端添加任何事件时启用了 pushnotification
。一切正常;显示 badge
、alert
、sound
一切正常,除了“banner
”。当应用程序处于后台模式时,横幅不显示,我认为我们这边没有什么可以为 'Banner' 编码的。这就是我注册 pushnotification
.
的方式
UIUserNotificationType types = UIUserNotificationTypeBadge |
UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings =
[UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
这是因为从后端发送的负载超过了允许的大小限制。
根据 official doc 允许的最大大小为:
- 对于常规远程通知,最大大小为 4KB (4096
字节)
- 对于互联网协议语音 (VoIP) 通知,最大
大小为 5KB(5120 字节)注意
我有一个 ios 项目,在从后端添加任何事件时启用了 pushnotification
。一切正常;显示 badge
、alert
、sound
一切正常,除了“banner
”。当应用程序处于后台模式时,横幅不显示,我认为我们这边没有什么可以为 'Banner' 编码的。这就是我注册 pushnotification
.
UIUserNotificationType types = UIUserNotificationTypeBadge |
UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
UIUserNotificationSettings *mySettings =
[UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
这是因为从后端发送的负载超过了允许的大小限制。 根据 official doc 允许的最大大小为:
- 对于常规远程通知,最大大小为 4KB (4096 字节)
- 对于互联网协议语音 (VoIP) 通知,最大 大小为 5KB(5120 字节)注意