因此,我们一直有人遇到一些问题,没有与我们的应用程序获得推送通知。用户删除并重新安装应用程序后管理分析_安装类
我们发现,当用户删除并重新安装应用程序,同时向我们提供另一个权限时,它会在_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");
});
});
``
控制台日志从parse
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
我想这个,但没有收到任何结果,即使在该类中它显然有额外的行。 – Steve