簡體   English   中英

如何在ios上的react-native-push-notification中向通知對象添加其他數據?

[英]How to add additional data to a notification object in react-native-push-notification on ios?

知道如何在ios上的react -push-push-notification中向通知對象添加其他數據?

目前我正在發送這個身體:

body = { aps: { alert: "Text that is sent in the notification.", sound: "default", badge: 1 } }.to_json

我無法弄清楚如何添加通知警報中未顯示的其他數據(如用戶ID),以便在用戶點擊通知時將用戶重定向到正確的視圖。

您可以向正文添加另一個屬性以傳遞其他數據:

body = { 
    aps: {
      alert: "Text that is sent in the notification.",
      sound: "default",
      badge: 1 
    },
    userId: "6446qf45qsdg",
}

有關詳細信息,請參閱從Apple文檔創建遠程通知有效負載

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM