Ios 按距离排序查询
我正在使用Parse并尝试运行一个查询,其中我的对象按距离以及特定比率的降序排序:Ios 按距离排序查询,ios,iphone,parse-platform,sdk,Ios,Iphone,Parse Platform,Sdk,我正在使用Parse并尝试运行一个查询,其中我的对象按距离以及特定比率的降序排序: PFQuery *moreGuysQuery = [PFQuery queryWithClassName:self.parseClassName]; [moreGuysQuery whereKey:@"Location" nearGeoPoint:self.currentLocation]; [moreGuysQuery orderByDescending:@"Ratio"]; 然而,我
PFQuery *moreGuysQuery = [PFQuery queryWithClassName:self.parseClassName];
[moreGuysQuery whereKey:@"Location" nearGeoPoint:self.currentLocation];
[moreGuysQuery orderByDescending:@"Ratio"];
然而,我发现这一比例是有先见之明的,而且位置没有考虑在内。我希望这个位置也能有预倾向性
这可能吗?只需制作一个数组即可解决此问题
PFQuery *moreGuysQuery = [PFQuery queryWithClassName:self.parseClassName];
NSSortDescriptor *sortByLocation = [[NSSortDescriptor alloc] initWithKey:QuoVenueLocation ascending:NO selector:@selector(localizedCompare:)];
NSSortDescriptor *sortByRatio = [[NSSortDescriptor alloc] initWithKey:QuoVenueStatsCrowdRatio ascending:NO selector:@selector(localizedCompare:)];
[moreGuysQuery orderBySortDescriptors:[NSArray arrayWithObjects:sortByLocation, sortByRatio, nil]];