简体   繁体   中英

How to update the data browser channels in parse.com?

I'm using Parse.com to send push notifications between devices through PFQuery as below

PFPush *push = [[PFPush alloc] init];
[push setChannel:[NSString stringWithFormat:@"User%@",id];
[push setMessage:@"You have a new message"];
[push sendPushInBackground];

It works fine. But, If I update the channels to any other object using,

PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation addUniqueObject:@"Giants1" forKey:@"channels"];
[currentInstallation saveInBackground];

The object got added to the channels in Data browser.

在此处输入图片说明

I just want to update the channels with the new object, not to add. How to do that? What is the PFquery to update channels?

Try:

currentInstallation.channels = @[ @"Giants1" ];

to replace all existing channels. The method you are currently using is explicitly adding to the existing list.

You should also be able to use setObject:forKey: to replace the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM