【发布时间】:2017-07-07 15:32:07
【问题描述】:
因此,我们遇到了一些问题,即人们无法通过我们的应用收到推送通知。
我们发现,当用户删除并重新安装应用程序同时给我们推送权限时,它会在 _Installation 类中创建另一行。
如果我们手动删除所有行并且用户安装应用并启用推送,则推送现在发送给用户。
所以问题是处理这种情况的最佳方法是什么,以确保每个人在安装或重新安装后在 _Installation 类中只有一行。
我正在尝试这个云功能,但它没有返回任何结果,即使在数据库中它为该用户提供了额外的行。
``
Parse.Cloud.beforeSave(Parse.Installation, function(request, response) {
var userId = request.object.get("user").id;
console.log("user id = " + userId)
query = new Parse.Query("_Installation");
query.equalTo("user", {__type: "Pointer", className: "User", objectId: userId})
query.find({ useMasterKey: true }).then(function(installations) {
console.log("Successfully retrieved " + installations.length + " item");
console.log(installations[0])
console.log(installations)
console.log('worked');
response.success("The user has been authorized.");
}, function(error) {
console.log('failed')
response.error("user authorization failed");
});
});
``
来自解析的控制台日志
Feb 20 17:09:33 likemoji-stage app/web.1: user id = t6yQIXiwvG
Feb 20 17:09:33 likemoji-stage app/web.1: Successfully retrieved 0 item
Feb 20 17:09:33 likemoji-stage app/web.1: undefined
Feb 20 17:09:33 likemoji-stage app/web.1: []
Feb 20 17:09:33 likemoji-stage app/web.1: worked
【问题讨论】:
-
我正在尝试这个,但没有收到任何结果,即使在那个类中它显然有额外的行。
标签: javascript ios swift parse-platform