我正在将用户数据User
从 Parse 类加载到PFQueryTableViewController
. 用户类代表来自 Facebook 的数据。现在,我不想将数据加载到PFQueryTable
当前登录的用户中。允许加载所有其他用户数据。这是我的查询,但它仍然从 User 类加载所有数据。有什么建议么?
- (PFQuery *)queryForTable
{
PFQuery *query;
//[query whereKey:@"FacebookID" notEqualTo:[[PFUser currentUser] objectForKey:@"FacebookID"]];
//[query whereKey:@"username" notEqualTo:[PFUser currentUser].username];
if (self.canSearch == 0) {
query = [PFQuery queryWithClassName:@"_User"];
[query whereKey:@"objectId" notEqualTo:[PFUser currentUser].objectId];
} else {
query = [PFQuery queryWithClassName:@"_User"];
[query whereKey:@"objectId" notEqualTo:[PFUser currentUser].objectId];
[query whereKey:@"username" matchesRegex:_searchbar.text];
}
[query orderByAscending:@"createdAt"];
// If Pull To Refresh is enabled, query against the network by default.
if (self.pullToRefreshEnabled) {
query.cachePolicy = kPFCachePolicyNetworkOnly;
}
// 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;
}
return query;
}