我正在使用 Parse.com通过 PFQuery 在设备之间发送推送通知,如下所示
PFPush *push = [[PFPush alloc] init];
[push setChannel:[NSString stringWithFormat:@"User%@",id];
[push setMessage:@"You have a new message"];
[push sendPushInBackground];
它工作正常。但是,如果我使用以下方法将 channel 更新为任何其他对象,
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation addUniqueObject:@"Giants1" forKey:@"channels"];
[currentInstallation saveInBackground];
对象已添加到数据浏览器的 channel 中。
我只想用新对象更新 channel ,而不是添加。怎么做?更新 channel 的 PFquery 是什么?
最佳答案
尝试:
currentInstallation.channels = @[ @"Giants1" ];
替换所有现有 channel 。您当前使用的方法正在明确添加到现有列表中。
您还应该能够使用 setObject:forKey:
来替换列表。
关于ios - 如何更新 parse.com 中的数据浏览器 channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21428810/