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

Custom fields not arriving #363

Open
geophile opened this issue Feb 9, 2019 · 0 comments
Open

Custom fields not arriving #363

geophile opened this issue Feb 9, 2019 · 0 comments

Comments

@geophile
Copy link

geophile commented Feb 9, 2019

I am using PayloadBuilder to create a notification, and everything works:

        PayloadBuilder builder = APNS.newPayload().alertTitle(title)
        push(deviceToken, builder.build());

I recently added custom fields:

        builder.customFields(customFields);

The notification arrives on my iPhone without the custom fields, which is not what I expected.

To debug, I printed builder.build() output on the sending side. Here it is, formatted and sanitized:

{"fooId":"6b76a0ae-edd3-4b83-8e0f-48c2501ea31f",
 "aps":{
     "alert":{"title":"TITLE","body":"BODY"}}}

Here is what is received by App.handleNotification (aps is the dictionary received by handleNotification)::

aps = {Swift.Dictionary<Swift.String, AnyObject>} 1 key/value pair
 [0] = "alert" -> 2 key/value pairs
  key = {Swift.String} "alert"
  object = {__NSDictionaryI * | 0x280e05dc0} 2 key/value pairs
   [0] = "title" -> "TITLE"
   [1] = "body" -> "BODY"

The custom field is missing. What am I doing wrong? Or si this a bug?

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

1 participant