通过AWS SNS进行iOS推送通知

时间:2016-08-19 11:06:29

标签: ios apple-push-notifications

通过AWS SNS进行iOS推送通知。 有效负载会显示在iOS设备通知面板中而不是消息中。

前:

{
"default": "Sample message",
"APNS": {
"aps": {
"alert": {
"body": "You have new message",
"title": "Sample message"
}
}
}
}

1 个答案:

答案 0 :(得分:1)

问题是您将aps保留在APNS内。

根据Apple文档,有效负载应该是这样的,

{
    "aps" : {
        "alert" : {
            "title" : "Game Request",
            "body" : "Bob wants to play poker",
            "action-loc-key" : "PLAY"
        },
        "badge" : 5
    },
    "acme1" : "bar",
    "acme2" : [ "bang",  "whiz" ]
}

注意:" aps"应该直接在键中使用,不应该将其包含在其他值中。

文档:https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH107-SW1),