我正在使用phonegap-plugin-push接收iOS應用程序上的自定義操作的推送通知。一切似乎都設置正確,但我仍然沒有得到操作按鈕。iOS推送通知中未顯示的自定義操作
這裏是我的PushNotification.init
:
onDeviceReady: function() {
var push = PushNotification.init({
"ios": {
"alert": "true",
"vibration": true,
"badge": "true",
"sound": "true",
"categories": {
"approveOnly": {
"yes": {
"title": "Approve",
"foreground": true,
"destructive": false
},
},
"approveOrReprove": {
"yes": {
"title": "Approve",
"foreground": true,
"destructive": false
},
"no": {
"title": "Reprove",
"foreground": true,
"destructive": true
},
},
},
},
});
},
這似乎產生適當的OBJ-C結構,通過我的日誌:
2015-12-28 18:12:51.314 Approval Inbox[989:131023] PushPlugin.register: better button setup
2015-12-28 18:12:51.314 Approval Inbox[989:131023] categories: key approveOrReprove
2015-12-28 18:12:51.315 Approval Inbox[989:131023] yes button added
2015-12-28 18:12:51.315 Approval Inbox[989:131023] no button added
2015-12-28 18:12:51.315 Approval Inbox[989:131023] Adding category approveOrReprove
2015-12-28 18:12:51.315 Approval Inbox[989:131023] categories: key approveOnly
2015-12-28 18:12:51.315 Approval Inbox[989:131023] yes button added
2015-12-28 18:12:51.315 Approval Inbox[989:131023] Adding category approveOnly
看來我真的還發送推送通知正常。這是要發送的對象的日誌:
{
"aps": {
"sound": "beep.wav",
"alert":{
"title": " long string",
"body": "long string"
},
"content-available": 1,
"category": "approveOrReprove"
}
}
我收到正確的通知,並且在收到它們時,我會記錄通知事件。下面是我的一切(category is there
):
2015-12-28 18:16:02.686 Approval Inbox[989:130923] Notification received
2015-12-28 18:16:02.686 Approval Inbox[989:130923] Push Plugin key: alert
2015-12-28 18:16:02.687 Approval Inbox[989:130923] Push Plugin key: category
2015-12-28 18:16:02.687 Approval Inbox[989:130923] Push Plugin key: sound
2015-12-28 18:16:02.687 Approval Inbox[989:130923] Push Plugin key: content-available
2015-12-28 18:16:02.702 Approval Inbox[989:130923] event: notification
2015-12-28 18:16:02.702 Approval Inbox[989:130923] {"title":"long string","sound":"beep.wav","additionalData":{"foreground":false,"category":"approveOrReprove","content-available":1},"message":"long string"}
我一樣下跌"foreground":false
和category
顯示出來裏面additionalData
不好的跡象,但我不能看到這可能會造成問題。
有人看到我在做錯了嗎?
我嘗試添加適當的PhoneGap-插件推標籤,但它尚未創建,我沒有足夠的積分創造它。所以我添加了舊的希望能夠修復它的人。對不起,如果這不是這樣做的適當方式。 –
你有沒有想過這個? –