选择Json推送,必须加"aps":{"alert":"...", "sound":"default"}.否则当app在后台的时候,收不到推送。
如果只是选择plainText,则app在后台也可以收到推送,收到的userInfo就是"aps":{"alert":"...", "sound":"default"}
Json 推送:
{
"aps": {
"alert": "Notification message with json data:T_shirt, product id:3988399364",
"sound": "default"
},
"productId": "3988399364",
"productName": "T-Shirt"
}
Plain Text 推送:
{
"aps":{
"alert":"Notification message with json data:T_shirt, product id:3988399364",
"sound":"default"
}
}