richsage / RMSPushNotificationsBundle

NOT MAINTAINED! ⛔️ Push notifications/messages for mobile devices. Supports iOS, Android (C2DM, GCM), Blackberry and Windows Mobile (toast only). A Symfony2 bundle.
MIT License
321 stars 152 forks source link

Use of JSON_FORCE_OBJECT in iOSNotification.php will not work with loc-args #39

Closed cvctimlindsay closed 11 years ago

cvctimlindsay commented 11 years ago

The format of loc-args in iOS message payload is an array. Using JSON_FORCE_OBJECT breaks the payload format by turning loc-args item into an object. This currently happens on lines 262 and 265 of iOSNotification.php It appears to be the only parameter that has this requirement, everything else is an object.

ZhukV commented 11 years ago

Please see documentation in iOS push notification!

Only aps.data can't large then 256 byte!

cvctimlindsay commented 11 years ago

The issue is that APNS expects to see { "aps": { "alert": { "loc-args" : ["parm1","parm2"] } } , but the JSON_FORCE_OBJECT turns it to { "aps" : { "alert" : { "loc-args": { "0":"parm1","1":"parm2"] } }

cvctimlindsay commented 11 years ago

JSON_FORCE_OBJECT shouldn't be needed as php's json_encode() will convert non-numeric array keys to objects anyway as this is its default behaviour. All the parameters necessary to run APNS are dictionary or string except for the "loc-args" which requires an array. Its impossible to use the library as it is with localised strings and parameter substitutions as allowed in the APNS documentation.

richsage commented 11 years ago

I'm happy with #40 to go in when it's rebased, so I'll close this for now pending the merge of that PR.