ios - Parse push notification results 0 sent -
got issue push notifications wondering if can help, trying send push notification specific users using query..... in loop containing pfobjects users details. nothing wrong set have similar code on messages page(chat) sends push each member. retrieving pushes on parse database correct usernames, nothing being sent :/ don't know issue ? maybe worth mentioning of users not have installation set up? using user have set. appreciated code below.
var pushquery:pfquery = pfinstallation.query() pushquery.wherekey("user", equalto: pushobject["username"]) var push:pfpush = pfpush() push.setquery(pushquery) push.setmessage("new task") push.sendpushinbackgroundwithblock({ (success: bool, error: nserror!) -> void in if (success){ println("worked?") } else { println( "this error \(error.localizeddescription)") } })
i believe targeting of push issue here.
pushquery.wherekey("user", equalto: pushobject["username"])
this line seems issue, because installation class stores "user"
key either objectid
of pfuser
or directly pointer. either way, matching on username
isn't right way go it. need additional query, matches on username
, , have return user, match installation query:
var innerquery : pfquery = pfuser.query() innerquery.wherekey("username", equalto: pushobject["username"]) var pushquery = pfinstallation.query() pushquery.wherekey("user", matchesquery: innerquery)
i translated functioning obj-c code, hope works in swift, general idea need send push installation based on user's username.
Comments
Post a Comment