Skip to content

Custom fields not arriving #363

Open
@geophile

Description

@geophile

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions