Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send a push with alert like a String instead of dictionary #209

Open
snoodlupa opened this issue Dec 18, 2014 · 2 comments
Open

How to send a push with alert like a String instead of dictionary #209

snoodlupa opened this issue Dec 18, 2014 · 2 comments

Comments

@snoodlupa
Copy link

Hi I need send with this payload

{
    "aps" : {
        "alert" : "message"
   }
}

Instead of

{
    "aps" : {
        "alert" : {
               "body":"message"
      }
}

How I do?
Now I perform the following statement

payload = APNS.newPayload().alertBody("message")

But I have the field body.

Thanks.

@snoodlupa snoodlupa changed the title How to send a push with alert like a String How to send a push with alert like a String instead of dictionary Dec 18, 2014
@matzew
Copy link
Collaborator

matzew commented Dec 18, 2014

why do you need json on the alert?

you can send custom key/value pairs, to be interpreted by your app,
see .customField("body", "message")

On Thu, Dec 18, 2014 at 11:48 AM, Matteo notifications@github.com wrote:

Hi I need send with this payload

{
"aps" : {
"alert" : "message"
}
}

Instead of

{
"aps" : {
"alert" : {
"body":"message"
}
}

How I do?
Now I perform the following statement

payload = APNS.newPayload().alertBody("message")

Thanks.


Reply to this email directly or view it on GitHub
#209.

Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

@snoodlupa
Copy link
Author

No.
The problem is if I use alertBody("message") I create a payload with field "body":"message". I need to have "alert":"message"

The current implementation build a payload like the first case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants