我第二次推送东西时解析推送通知不起作用

时间:2016-01-15 12:52:48

标签: ios swift parse-platform apple-push-notifications

我在当前项目中使用Parse进行推送通知。当我推送一些数据时,它第一次正常工作。但如果我尝试第二次尝试发送它就会失败。

以下是代码:

var pushQuery = PFInstallation.query()
pushQuery?.whereKey("user", equalTo:"abcd@gmail.com")

var push = PFPush()
push.setQuery(pushQuery)
let aQuestion = self.mcqs[self.quesCount] as MultipleChoiceQuestion
push.setMessage("A question has been assigned to you.")

let data = ["alert":"A question has been assigned to you.",
"notification_type":"teacher_pushing_question",
"question_id":"\(aQuestion.questionId)",
"session_id":assessmentSession.objectId!]

push.setData(data)

push.sendPushInBackgroundWithBlock({ (success:Bool, error:NSError?) -> Void in
   if success{
     println(" Question Pushed successfully ")
   }else{
     println(" Question push not send ")
   }
})

知道它为什么不第二次推送数据?

此致!!

0 个答案:

没有答案