Silent Push Notification
Hi jpoz,
I'm trying to use silent push notification, and it seen need to provide the key "content-available" with a value of 1, so that I can use it. But, when I write:
APNS.send_notification(device_token, :content-available => 1}
It'll send a syntax error message. How can I solve it?
Hi p581581
Check your parenthesis
APNS.send_notification(device_token, :content-available => 1}
vs
APNS.send_notification(device_token, :content-available => 1)
You have to use an underscore instead of a dash
APNS.send_notification(device_token, :content_available => 1)
@sbhklr interesting behavior we noticed with underscore actually. Apple won't deliver the message if we use the underscore option. However, 'content-available' doesn't do what it's supposed to do if we pass that.
@sarmiena Works for me. If you pass the symbol :content_available => 1 as a parameter the script sends "content-available" under the hood. Have a look at the source code.
@sbhklr its works for me as well. Thank you.