现在,在我的应用程序中,用户可以发布图像,它会将用户的当前位置与图像一起保存。在表视图中,我希望它查询距离用户区域5-10公里的图像。此外,用户的地理位置也保存在他们的配置文件中。
我知道有这样的代码:
query.whereKey("location", nearGeoPoint: usergeo, withinKilometers: limitlocation)但那是在x英里内,我想要x英里外。
发布于 2015-08-01 10:10:19
我不认为Parse的SDK中有任何东西可以做到这一点。您必须手动计算5到10英里之外的一系列geoPoints,并将它们用作nearGeoPoint查询的geoPoint值。
我可能误解了你--你只是想知道geoPoints离用户有多远吗?你也得手动计算一下...
下面是一个用于确定到CLLocations的距离的链接,您可以从geoPoints:Calculate distance between two place using latitude-longitude in gmap for iPhone创建该链接
编辑:我忘了你问的是如何在swift中做到这一点,而不是objective-c:iOS: (Swift) How to show distance from current location and exist annotation on annotation subtitle
https://stackoverflow.com/questions/31757091
复制相似问题