如何在Parse中向特定用户发送推送通知?

时间:2015-08-03 03:15:34

标签: ios swift parse-platform

我希望通过推送通知在两个用户之间交换消息。 我已经能够成功发送我的推送进行解析,但是无法将消息传递给targetUser ...

这是我的代码:

 var userQuery: PFQuery = PFUser.query()!
     userQuery.whereKey("targetUser", equalTo: self.userList.objectAtIndex(indexPath.row))


            let pushQuery: PFQuery = PFInstallation.query()!
            pushQuery.whereKey("user", equalTo: PFUser.currentUser()!)
            pushQuery.whereKey("targetUser", matchesQuery: userQuery)

            //pushQuery.whereKey("targetUser", equalTo: self.userList.objectAtIndex(indexPath.row))


            let push: PFPush = PFPush()
            push.setQuery(pushQuery)

            let textfields:NSArray = messageAlert.textFields as! NSArray
            let messageTextField: UITextField = textfields.objectAtIndex(0) as! UITextField

            push.setMessage(messageTextField.text)

            push.sendPushInBackground()

        }))

有什么建议吗?

0 个答案:

没有答案