知道如何在 ios 上的 react -native-push-notification中向通知对象添加额外的数据吗?
目前我将其作为正文发送:
body = { aps: { alert: "Text that is sent in the notification.", sound: "default", badge: 1 } }.to_json
我不知道如何添加不会在通知警报中显示的其他数据,例如用户 ID,以便在用户单击通知时将用户重定向到正确的视图。
知道如何在 ios 上的 react -native-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 文档创建远程通知有效负载。