iOS Push Notification Custom Data - A wrong solution?

Hey,

we currently struggled to receive a custom payload when receiving remote push notifications on iOS.

As we found out, corona assumes that the JSON-String that contains the push information looks something like this (php example):

[lua][‘aps’] = array(
    ‘alert’ => $message,
    ‘sound’ => ‘default’,
    ‘badge’ => 4,
    ‘custom’ => array(‘anumber’ => 1, ‘aboolean’ => true, ‘astring’ => ‘stringvalue’, ‘afloat’ => 3.1415),
);[/lua]

source:

http://forums.coronalabs.com/topic/29982-custom-push-data/?hl=%2Bpush+%2Bnotification+%2Bpayload#entry161711

As apple mentions (and every third party apn tool for sending iOS push notifications does) the custom data field is placed at the same level as the ‘aps’ object, not within the ‘aps’ object resulting in:

[lua]

[‘aps’] = array(
    ‘alert’ => $message,
    ‘sound’ => ‘default’,
    ‘badge’ => 4,
),

[‘custom’] = array(‘anumber’ => 1, ‘aboolean’ => true, ‘astring’ => ‘stringvalue’, ‘afloat’ => 3.1415)

[/lua]

That could be the cause why so many other developers struggle to receive the custom data.

I made a bug report about this (Case 22669). I suggest you check for the custom outside the aps object, if no custom data is set in the aps object to be compatible to third party software.

Cheers

A change has been made to support the custom field being set outside of the ‘aps’ body. This should be available soon in the upcoming daily builds.

A change has been made to support the custom field being set outside of the ‘aps’ body. This should be available soon in the upcoming daily builds.

When will this be fixed? We do need this fixed. 

Thank you

is this also what causes the push custom data to return an empty table with corona cloud maybe?

Push Notification with cloud is a pain. I have spent tremendous amount of time figuring out the proper way to handle iOS Push Notifications and I succeeded to make it in elegant way with Parse.com as a backend.

I thought some of you guys might want to save long hours of testing so I packet everything up for you: CoronaSDK iOS Push Notifications

When will this be fixed? We do need this fixed. 

Thank you

is this also what causes the push custom data to return an empty table with corona cloud maybe?

Push Notification with cloud is a pain. I have spent tremendous amount of time figuring out the proper way to handle iOS Push Notifications and I succeeded to make it in elegant way with Parse.com as a backend.

I thought some of you guys might want to save long hours of testing so I packet everything up for you: CoronaSDK iOS Push Notifications