简体   繁体   English

如何更新parse.com中的数据浏览器频道?

[英]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 我正在使用Parse.com通过PFQuery在设备之间发送推送通知,如下所示

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? 什么是更新频道的PFquery?

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. 您还应该能够使用setObject:forKey:替换列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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