【问题标题】:Retrieve all guildmembers in the same guild as you using Parse使用 Parse 检索与您在同一个公会中的所有公会成员
【发布时间】:2014-10-11 22:17:19
【问题描述】:

我如何使用解析检索你公会中的所有公会成员?

这是我的代码:

PFUser *currentuser = [PFUser currentUser];
PFQuery *query = [PFQuery queryWithClassName:@"User"];
[query whereKey:@"connectedGuild" equalTo:currentuser[@"connectedGuild"]];
[query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
    NSLog(@"There are %d guildmembers. Error:%@", comments.count, error);
}];

我的日志:

有0个公会成员。错误:(空)

connectedGuild 是一个指向我存储所有公会的公会类的指针。

【问题讨论】:

  • 你确定你有正确的类名和密钥吗?你的代码看起来不错......

标签: ios objective-c parse-platform pfquery pfuser


【解决方案1】:

PFUser 类的查询必须以稍微不同的方式实例化。试试这个:

PFUser *currentuser = [PFUser currentUser];
PFQuery *query = [PFUser query];
[query whereKey:@"connectedGuild" equalTo:currentuser[@"connectedGuild"]];
[query findObjectsInBackgroundWithBlock:^(NSArray *comments, NSError *error) {
    NSLog(@"There are %d guildmembers. Error:%@", comments.count, error);
}];

有关详细信息,请参阅此处的 Parse.com 网站: https://www.parse.com/questions/get-pfuser-in-pfquery-using-ios-api

【讨论】:

    猜你喜欢
    • 2018-12-29
    • 2019-06-04
    • 1970-01-01
    • 2021-05-29
    • 2021-02-18
    • 1970-01-01
    • 2020-11-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多