Menu

#363 Custom fields not arriving

open
nobody
None
2019-02-09
2019-02-09
Anonymous
No

Originally created by: 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?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.