Accessing data from an API response is iOS app -
Accessing data from an API response is iOS app -
i have ios app working on , when create phone call api, kind of info set back:
{ "finished_on" = 1414499584; id = 4370760; ip = "1.1.1.1"; mode = 1; name = asdasdasdasd1; remaining = 420; score = 0; "simulation_block" = 0; "simulation_id" = 0; "simulation_type" = 0; "started_on" = 1414499583; status = "-1"; step = 1; total = 5; }
the api phone call uses this:
afhttprequestoperation *op = [[afhttprequestoperation alloc] initwithrequest:req]; op.responseserializer = [afjsonresponseserializer serializer]; [op setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) {
and response coming [responseobject description].
this works , works everywhere else in app. no problem there. confused on how can work info reason.
can tell me how can access parts of data? example, i'm wanting pull out "name". when inspect info in xcode, it's telling me nsobject. , i've tried converting downwards json string , other ways, i'm having no luck.
you're using description
directive, outputs nsstring representation of info contained object. need access actual contents of object returned responseobject
akin to:
responseobject[@"name"];
... implementation depends on how afnetworking returning responseobject
.
ios api nsarray nsobject
Comments
Post a Comment