【问题标题】:Parse.com push notification badge valueParse.com 推送通知徽章值
【发布时间】:2012-12-10 09:02:19
【问题描述】:

我在 iOS 应用中使用 parse.comiOS Parse Framework。我想向频道发送推送通知,但我希望将徽章的值设置为 1,即使用户收到多个通知。

这是用于发送通知的代码,取自文档:

NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
    @"Here is the content of the notification !", @"alert",
    @"Increment", @"badge",
    @"cheering.caf", @"sound",
    nil];
PFPush *push = [[PFPush alloc] init];
[push setChannels:[NSArray arrayWithObjects:@"A Channel", nil]];
[push setData:data];
[push sendPushInBackground];

这里是what they say(转到“发送选项”>“自定义通知”)关于字典中badge 键的值:

徽章: (仅限 iOS) 应用图标右上角指示的值。 这可以设置为一个值或 Increment 以将当前值增加 1。

很明显,@"Increment" 的值可以正常工作,但我想始终将徽章值设置为“1”。

什么是正确的语法?好像没找到!

【问题讨论】:

    标签: ios push-notification badge parse-platform


    【解决方案1】:

    您应该使用 NSNumber。即

    [push setData:@{
        @"alert": @"Here is the content of the notification !",
        @"badge": @1,
        @"sound": @"cheering.caf"}];
    

    【讨论】:

    • 谢谢,我会尽快尝试,以确保它有效;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 2011-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-28
    相关资源
    最近更新 更多