簡體   English   中英

Parse.com推送通知徽章值

[英]Parse.com push notification badge value

我在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];

以下是他們所說的內容 (轉到“發送選項”>“自定義通知”),關於字典中badge鍵的值:

徽章:( 僅限iOS)應用程序圖標右上角顯示的值。 這可以設置為值或增量,以便將當前值增加1。

顯然,值@"Increment"工作正常,但我想始終將徽章值設置為“ 1 ”。

什么是正確的語法? 我似乎無法找到它!

你應該使用NSNumber。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM