ios - 推送通知不是来自解析云代码

标签 ios parse-platform push-notification parse-cloud-code

我编写了一个简单的作业来尝试向自己发送推送通知。这是代码:

Parse.Cloud.job("testPush", function(request, status) {
    Parse.Cloud.useMasterKey();
    var installationQuery = new Parse.Query(Parse.Installation);
    installationQuery.equalTo("user", "6t1JIuNqe1");  // I triple checked - this is the value of my user in the installation table.
    Parse.Push.send({
        where: installationQuery,
        data: {
            alert: "Test"
        },
    }, {
        success: function() {
            console.log("The Push Test Worked!");
            status.success("All done with the push test!");
        }, error: function(error) {
            console.error("Something bad happened " + error);
            status.error("Something bad happened during the Parse test...");
        }
    });
});

虽然它在 Parse 中记录作业已成功运行,但我从未在我的 iPhone 上看到通知。我检查了“设置”- 那里的所有设置都正确(通知可以出现并且应该显示为横幅,它们应该出现在通知中心,它们应该出现在我的锁定屏幕上)。然而通知从未出现。

我还需要检查什么?我错过了什么?

最佳答案

指针字段应与实例一起使用。

尝试将 installationQuery.equalTo("user", "6t1JIuNqe1"); 替换为以下内容:

var user = new Parse.User();
user.id = '6t1JIuNqe1';    
installationQuery.equalTo('user', user);

关于ios - 推送通知不是来自解析云代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27221267/

相关文章:

ssl - Cloudflare 上通过 SSL 的 Elastic Beanstalk

amazon-s3 - 如何使用经过 Parse 身份验证的用户授予对非公共(public) Amazon S3 存储桶文件夹的访问权限

javascript - 如何在 Parse 云代码上安装外部 javascript 库

swift - 如何在收到通知且启用 Touch ID 时打开特定 ViewController

ios - 如何使用预构建的二进制文件创建 .ipa 文件?

ios - swift 4 : Add View on top of all controllers

ios - 使用 Swifter 框架/库发布带有照片的推文

ios - 在相机 View 中显示 UIView

ios - 在 testflight 上推送通知

java - Android Push Notification 从设备到其他设备