简体   繁体   中英

How can I make PFQueryTableViewController return all data? Not just current user?

I subclassed PFQueryTableViewController, but It will only return the data for the currently logged in user. How can I make it retrieve data from all users?

Code For the query

- (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;
}

From the Parse Documentation you can change a PFObject's permission on a per user or group basis - which the PFQueryTableViewController will abide by. So if your table is only displaying objects for the current user it is probable that the objects were secured like:

object.ACL = [PFACL ACLWithUser:[PFUser currentUser]];

Before being saved to parse. To allow an object to be read by all users you can set the permissions like so:

PFACL *acl = [PFACL ACLWithUser:[PFUser currentUser]];
[acl setPublicReadAccess:YES];
object.ACL = acl;

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