App Badge 不显示 Parse 推送通知

App Badge not showing with Parse Push Notifications

我正在使用 Parse 作为我的 iOS 应用程序的后端来发送推送通知。我的问题是应用程序图标在收到推送通知后从不显示徽章(除了徽章,一切正常)。

我检查了 Parse 上安装数据库中的 "badge" 字段,它随着每次推送而增加,所以我觉得这可能是客户端问题

这是我的云代码:

Parse.Push.send({
    where: pushQuery,
    data: {
        aps: {
            alert: "Your friend " + request.user.get("Name") + " just joined VoiceMe!",
            sound: "default",
            AlertType: "NewFriend"
        },
        badge: "Increment"
    }
}, {
    success: function() {
        /*all is good*/
    },
    error: function(error) {
        outcome = false;
        errorOutput = error;
    }
});

我应用中的代码:

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    let currentInstallation = PFInstallation.currentInstallation()
    if PFUser.currentUser() != nil {
        currentInstallation.setObject(PFUser.currentUser()!, forKey: kParseInstallationUserKey)
    }
    currentInstallation.setDeviceTokenFromData(deviceToken)
    currentInstallation.channels = ["global"]
    currentInstallation.saveInBackgroundWithBlock { (resultBool, error) -> Void in
        println("register device: --- \(resultBool) ---- error: \(error)")
    }
}

Parse 上安装数据库的图像:

在这里查看我的回答: 供参考

您已经创建了自己的词典。这用于交互式通知等。徽章在您创建的字典之外,该字典是用于发送推送的 correct 字典。这就是为什么它不会增加您在 aps 字典下创建的有效负载。你必须告诉它。否则,只需删除 aps 字典并通过数据字典传递你的参数