我正在尝试在距离当前用户位置一定距离内的特定频道中ping所有用户。我坚持的问题是我无法满足这两个限制。一个或另一个单独工作。有了这两个,消息就会以某种方式发送给任何人。我在这里错过了什么吗?提前谢谢!
func findDriver(loc: CLLocationCoordinate2D) {
let driverQuery = PFInstallation.query()
driverQuery?.whereKey("channels", equalTo:"drivers")
let geoPoint = PFGeoPoint(latitude: loc.latitude, longitude: loc.longitude)
driverQuery?.whereKey("location", nearGeoPoint: geoPoint)
let push = PFPush()
push.setQuery(driverQuery)
push.setMessage("Looking for Drivers!")
push.sendPushInBackground()
}
答案 0 :(得分:0)
也许尝试为查询执行AND操作?
这是链接:https://www.parse.com/questions/combining-or-queries
func findDriver(loc: CLLocationCoordinate2D) {
let driverQuery = PFInstallation.query()
driverQuery?.whereKey("channels", equalTo:"drivers")
let geoPoint = PFGeoPoint(latitude: loc.latitude, longitude: loc.longitude)
driverQuery?.whereKey("location", nearGeoPoint: geoPoint)
let comboQuery = PFQuery.query()
comboQuery?.whereKey("channels", matchesKey:"channels", inQuery:driverQuery)
comboQuery?.whereKey("location", matchesKey:"location", inQuery:geoPoint)
let push = PFPush()
push.setQuery(comboQuery)
push.setMessage("Looking for Drivers!")
push.sendPushInBackground()
}