ios - 应用程序角标(Badge)不显示解析推送通知

标签 ios parse-platform push-notification badge

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

我已经检查了 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 上安装数据库的图像:
enter image description here

最佳答案

在这里查看我的答案:https://stackoverflow.com/a/27615528/2353523以供引用

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

关于ios - 应用程序角标(Badge)不显示解析推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29996774/

相关文章:

ios - 有没有办法更改 UILocalNotification 的时间之前的文本?

objective-c - 类型参数不能应用于 PFAnalytics 和 PFObject 中的非参数化类 BFTask

ios - 获取空的用户名字符串

Android - 将用户发送到 Activity 的 GCM 推送通知不会导致 onCreate 调用

ios - Objective-C - 推送通知不适用于 Cloudkit

ios - 操作无法完成 IDETemplateParseError error1

ios - CallKit com.apple.CallKit.error.calldirectorymanager 错误 1

ios - 在 swift 中的参数中发送多个数组

javascript - 如何在 Parse-SDK-JS 中创建具有关系的新 Parse.Object

ios - 通知在 APNS 服务器上存储多长时间?