【问题标题】:IOS Push Notifications using Parse使用 Parse 的 IOS 推送通知
【发布时间】:2016-04-21 19:08:21
【问题描述】:

我正在尝试在距当前用户位置一定距离内的某个频道中对所有用户进行 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()

}

【问题讨论】:

    标签: ios swift parse-platform push-notification


    【解决方案1】:

    也许尝试做 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()
    
    }
    

    【讨论】:

      猜你喜欢
      • 2016-03-13
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多