如何做一个whereKey所以它查询post___公里+从当前用户AWAY?

var limitlocation = 5 as Double if let usergeo = currentuser.objectForKey("location") as? PFGeoPoint { query.whereKey("location", nearGeoPoint: usergeo, withinKilometers: limitlocation) } 

目前有这样的,但它得到在5公里以内的用户。 我如何使它成为5 km + AWAY。

默认情况下,这种types的查询将只允许您查询距离要查询的geoPoint 100英里范围内的geoPoints: https ://www.parse.com/docs/ios/guide#geopoints-caveats。

你可以做的是过滤结果,并删除5公里内的任何结果。

这是它在objective-c中的样子 – 你必须把它翻译成swift

 NSMutalbeArray* mutableObjects = [[NSMutableArray alloc] init]; PFGeoPoint* userGeoPoint = user[@"geoPoint"]; for (PFObject* object in objects) { PFGeoPoint* objectGeoPoint = object[@"geoPoint"]; CLLocation *locA = [[CLLocation alloc] initWithLatitude:userGeoPoint.latitude longitude:userGeoPoint.longitude]; CLLocation *locB = [[CLLocation alloc] initWithLatitude:objectGeoPoint.latitude longitude:objectGeoPoint.longitude]; CLLocationDistance distance = [locA distanceFromLocation:locB]; // Distance in meters if (distance >= 5000) { [mutableObjects add:object]; } }