Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.39k stars 1.52k forks source link

Could not set CustomeItem in Apple Push Notification if it is not a primitive type. #248

Closed volkovku closed 8 years ago

volkovku commented 11 years ago

Hello. I use you library for send Apple Push Notifications. It's awsome, but I have problem with custom payload data. Payload just a JSON object, but I can't add custom item if an item is not a primitive type. I get you source code and in AppleNotificationPayload.cs I found follow line (line 124):

json[key] = new JValue(this.CustomItems[key][0]);

I think it's a bug, because custom item can be an object, not just primitive type. In next line you use array, and I use it as workaround (pass first element as JObject, and second as null, and it's work).

Thanks.

Redth commented 10 years ago

I'd recommend serializing your custom object to json then at this point...