ios:推送通知徽章计数不会在此有效负载中增加
ios : push notification badge count not increase in this payload formate
当应用程序在后台正常运行时,前 5 天未设置时间徽章计数。
徽章计数每次增加 php 后端 ex。当前徽章 = 10 然后在第二次推送后得到然后徽章 = 11
我正在使用波纹管有效载荷甲酸盐。
如果波纹管甲酸盐有任何变化,请帮助我,我也阅读 Apple Push Notification Service.
推送通知负载是 JSON 负载:
{
"aps": {
"badge": 10,
"alert": "Hello world!",
"sound": "cat.caf"
}
}
registerUserNotificationSettings
if (ios8)
{
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
根据Apple documentation中payload keys的描述,与key badge关联的值必须是一个数字,所以你不能从payload增加badge值(否则你无法区分增量或徽章设置为 1)。
您可以在服务器端保存徽章值并在服务器上递增,因此对于用户来说它看起来像是递增。
当应用程序在后台正常运行时,前 5 天未设置时间徽章计数。
徽章计数每次增加 php 后端 ex。当前徽章 = 10 然后在第二次推送后得到然后徽章 = 11
我正在使用波纹管有效载荷甲酸盐。
如果波纹管甲酸盐有任何变化,请帮助我,我也阅读 Apple Push Notification Service.
推送通知负载是 JSON 负载:
{
"aps": {
"badge": 10,
"alert": "Hello world!",
"sound": "cat.caf"
}
}
registerUserNotificationSettings
if (ios8)
{
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
根据Apple documentation中payload keys的描述,与key badge关联的值必须是一个数字,所以你不能从payload增加badge值(否则你无法区分增量或徽章设置为 1)。
您可以在服务器端保存徽章值并在服务器上递增,因此对于用户来说它看起来像是递增。