我有 UITableView,其中包含从 Parse.com 获取的数据。当我尝试根据 NSArray 过滤它们时,它没有显示任何结果。没有 whereKey:containedIn,一切正常。 NSArray *array 很好地返回字符串数组。所以问题一定是在方法 containsIn 中,有什么想法吗?
PFUser *user = [PFUser currentUser];
NSArray *array = [[PFUser currentUser] objectForKey:@"favorites"];
NSLog(@"ARR:%@", array);
if (user) {
quer = [PFQuery queryWithClassName:@"bs"];
[quer whereKey:@"objectId" containedIn:array];
[quer findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
self.itemss = [objects mutableCopy];
NSLog(@"KOL::%lu", (unsigned long)[objects count]);
[self.MainTable reloadData];
if (objects.count ==0) {
} else {
}
} else {
[quer cancel];
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
} else {
NSLog(@"no");
}
}
最佳答案
当我确定它应该是一个 objectId 数组时,“favorites”数组是一个收藏对象数组。如果您创建一个包含收藏对象的 objectId 的数组,那么它应该可以工作。
关于ios - Parse.com WhereKey :containedIn doesn`t show any results - objectId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28437029/