您将data
字段设置为传递给字典的键,OneSignal.postNotification
如下所示.
OneSignal.postNotification(["contents": ["en": "Test Message"], "include_player_ids": ["3009e210-3166-11e5-bc1b-db44eb02b120"], "data": ["postID": "id"]])
然后,你需要准备好你的钥匙从additionalData
来自payload
于handleNotificationAction
功能.
if let additionalData = payload?.additionalData { let postID: String? = additionalData["postID"] }