Can you please guide us on how to send a notification with a title for iOS 10?
We tried like this
OneSignal.postNotification(["contents": ["en": message],
"data": payload,
"title": title,
"ios_badgeCount" : 1,
"ios_badgeType": "Increase",
"include_player_ids": [recieverId]])
and like this
OneSignal.postNotification(["contents": ["en": message, "title": title],
"data": payload,
"ios_badgeCount" : 1,
"ios_badgeType": "Increase",
"include_player_ids": [recieverId]])
but it didn't work.
@KMSoft2013 For title you will need to add a headers field, it is same object format as contents.
OneSignal.postNotification([
"contents": ["en": messageBody],
"headings": ["en": messageTitle],
"title": title,
"data": payload,
"ios_badgeCount" : 1,
"ios_badgeType": "Increase",
"include_player_ids": [recieverId]
])
All others options from the REST API are accessible as well, except for other targeting parameters.
https://documentation.onesignal.com/reference#create-notification
Thanks, @jkasten2 Now I can send a notification with a title.
Most helpful comment
@KMSoft2013 For title you will need to add a
headersfield, it is same object format ascontents.All others options from the REST API are accessible as well, except for other targeting parameters.
https://documentation.onesignal.com/reference#create-notification