我将PFQueryTableViewController子类化,但它只返回当前登录用户的数据。如何让它从所有用户检索数据?
- (PFQuery *)queryForTable {
PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];
// If no objects are loaded in memory, we look to the cache first to fill the table
// and then subsequently do a query against the network.
//if (self.objects.count == 0) {
// query.cachePolicy = kPFCachePolicyCacheThenNetwork;
//}
//[query orderByDescending:@"QuestionA"];
//[query whereKey:@"post" equalTo:@"0"];
//NSLog(@"%@",query);
return query;
}
答案 0 :(得分:0)
从Parse Documentation开始,您可以基于每个用户或组更改PFObject的权限 - PFQueryTableViewController将遵守该权限。因此,如果您的表仅显示当前用户的对象,则很可能对象的安全性如下:
object.ACL = [PFACL ACLWithUser:[PFUser currentUser]];
在保存到解析之前。要允许所有用户读取对象,您可以设置权限,如下所示:
PFACL *acl = [PFACL ACLWithUser:[PFUser currentUser]];
[acl setPublicReadAccess:YES];
object.ACL = acl;