ios - How to send JSON data via Parse Push Notification -


i want send json data parse push notification want send data this:

{    "action": "android.intent.action.push_state",    "alert": "welcome",     "message": "123123,123,123"  } 

i using following code:

 nsdictionary * postdictionary = [nsdictionary dictionarywithobjects:  [nsarray arraywithobjects:@"action", @"alert",@"message" nil]                                                                 forkeys:[nsarray arraywithobjects:@"android.intent.action.push_state", @"welcome",@"123123,123,123", nil]];      nserror * error = nil;     nsdata * jsondata = [nsjsonserialization datawithjsonobject:postdictionary options:nsjsonreadingmutablecontainers error:&error];      [push setmessage:jsondata];     [push sendpushinbackground]; 

i getting error that:

cannot initialize paramaeter of type nsstring* lvalue of type nsdata* ___strong

the json payload documented in rest api push notifications guide. "alert" key should string within "data" hash, not "aps". also, make sure pass string in "oid" key, if you're not doing already.

a valid json payload be:

{     "data": {         "alert": "push_notification_msg",         "sound": "",         "cdata": {             "type": 2,             "oid": "xxx"         },         "action-loc-key": "push_notification_btn",         "loc-key": "push_notification_msg"     } } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -