Closed cvctimlindsay closed 11 years ago
Please see documentation in iOS push notification!
Only aps.data can't large then 256 byte!
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"] } }
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.
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.
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.