首页 > 解决方案 > Urban Airship 显示错误的 JSON 有效负载

问题描述

我正在尝试从 Urban Airship 门户发送测试推送。我有设备的通道 ID,创建了 JSON 有效负载。但是,当我尝试发送时,它总是显示错误,对不起,这看起来不像是有效的 JSON。以下是我的有效载荷数据,请帮助我。

{
    "audience": {
        "ios_channel": "938a3a93-1a5f-466c-923b-827ef4b0a75b"
    },
    "notification": {
       "aps": {
            "alert": {
                "body": "Sample",
                "title": "Sample"
         }
       }
        "ios": {
            "badge": 3
        }
    },
    "device_types": [
        "ios"
    ]
} 

标签: iosnotificationspush

解决方案


这有效,你忘了一个逗号,你可以使用https://jsonlint.com 来做这样的事情

{
    "audience": {
        "ios_channel": "938a3a93-1a5f-466c-923b-827ef4b0a75b"
    },
    "notification": {
        "aps": {
            "alert": {
                "body": "Sample",
                "title": "Sample"
            }
        },
        "ios": {
            "badge": 3
        }
    },
    "device_types": [
    "ios"
    ]
}

推荐阅读