ios:推送通知徽章数不会增加此有效负载格式

时间:2016-03-04 07:52:57

标签: ios iphone swift apple-push-notifications

在背景中申请时间标记计数未设置在最后5天之前正常工作 徽章计数每次增加由php后端ex。当前徽章= 10然后在第二次推送之后获得徽章= 11


我正在使用波纹管有效甲酸盐。
如果波纹管甲酸盐有任何变化,那么请帮我读一读Apple Push Notification Service.

推送通知有效负载是JSON有效负载:

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)];
    }


 registerUserNotificationSettings

SELECT
-- Get Total_Returned Count
(Select distinct
count(*) as 'Total_Returned'
From
(   SELECT     
        [SN]
       ,[RMA]
    FROM [dbo].[test]
    Group by [SN],[RMA]
)a) AS 'Total_Returned'
-- Get Repeat_Return Count
,(Select distinct
[Repeat_Return] - COUNT(*) OVER() AS [Repeat_Return]     
From
(   SELECT
         COUNT(*) OVER() AS [Repeat_Return]     
        ,[SN]
        ,[RMA]
    FROM [dbo].[test]
    Group by [SN],[RMA]
)a Group by [SN],[Repeat_Return]) AS 'Repeat_Return'
-- Get Same_Symptom_Return Count
,(Select distinct 
[Same_Symptom_Return] - COUNT(*) OVER() AS [Same_Symptom_Return]     
From
(   SELECT
         COUNT(*) OVER() AS [Same_Symptom_Return]     
        ,[SN]
        ,[RMA]
        ,SYMPTOM
    FROM [dbo].[test]
    Group by SN, SYMPTOM, RMA
)a Group by [SN], SYMPTOM, [Same_Symptom_Return]) AS 'Same_Symptom_Return'

1 个答案:

答案 0 :(得分:2)

根据Apple documentation中有效负载密钥的说明,与密钥徽章关联的值必须是数字,因此您无法从有效负载中增加徽章值(否则您无法使用t区分增量或徽章设置为1)。

您可以保存徽章值服务器端并在服务器上增加,因此它看起来像是用户的增量。