Swift Parse: How to send notification to specific device / objectId
I'm trying to send a notification to a specific user in my users table, but my function didn't work and I don't understand why.
func testPush(){
let message = "Alert !!"
let id = "88yhi9j0"
var data = [ "title": "Some Title",
"alert": message]
var userQuery: PFQuery = PFUser.query()
userQuery.whereKey("objectId", equalTo: id)
var query: PFQuery = PFInstallation.query()
query.whereKey("currentUser", equalTo: userQuery)
var push: PFPush = PFPush()
push.setQuery(query)
push.setData(data)
push.sendPushInBackground()
}
Does anyone have any ideas?
+1
source to share