Followed the documentation for Parse advanced targeting and push notifications are still not sending. (I can receive pushes from Parse's console and client push is enabled.)
let userQuery: PFQuery = PFUser.query()!
userQuery.whereKey("objectId", equalTo: "JrePAMWUbm") // The user I am logged in with
let pushQuery: PFQuery = PFInstallation.query()!
pushQuery.whereKey("user", matchesQuery: userQuery)
let push = PFPush()
push.setQuery(pushQuery)
push.setMessage("Hello, World!")
push.sendPushInBackgroundWithBlock {
success, error in
if success {
println("The push succeeded.")
} else {
println("The push failed.")
}
}
I keep getting "The push succeeded." But I look at Push Details, and it says "0 Pushes Sent."
If I remove the userQuery and only use a PFInstallation query, I receive a notification.
let pushQuery: PFQuery = PFInstallation.query()!
pushQuery.whereKey("deviceType", equalTo: "ios")
let push = PFPush()
push.setQuery(pushQuery)
push.setMessage("Hello, World!")
push.sendPushInBackgroundWithBlock(nil)
Something is likely wrong with userQuery
, but I'm not sure what. Return type isn't compatible with pushQuery.whereKey("user", matchesQuery: userQuery)
?