I would like to know how to send an apple push notification message with multiple lines. Using '\n' doesn't seem to work.
Something like:
First line
Second Line
Right now it seems to just ignore the message altogether.
Push notifications have word boundations. Meaning, their title cannot exceed a character limit of about 48 characters; copy content limits to 100 characters; and a call-to-action button.
iOS push notification character limits are 110 characters for both iOS lock screen and notification center. That's about 4 lines of text.
An iOS push notification is a message that pops up on an Apple device such as an iPhone. Before receiving push notifications from an app, iOS device users must explicitly give permission. Once a user opts-in, mobile app publishers can send push notifications to the users' mobile devices.
You cannot send multi line push with a escape, it will not work!
simply tried to send push with Parse:
Payload without an escape:
{ "alert": "Send me\na push without escape", "sound": "default" }
Result:
Payload with an escape
{ "alert": "Send me\\na push with escape", "sound": "default" }
Result:
Add a localizable strings file and add your string there. For example, you could have something like:
"Push_String" = "My push string with a line break\n and argument: %@";
Now in your notification payload, use the loc-key and loc-args properties, for example:
"loc-key":"Push_String","loc-args":["My argument!"]
Now you should have a line break in your notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With