ios - Convert NSData object to NSArray -
this question has answer here:
- need convert nsdata nsarray 2 answers
i response server in format this:
[_postviolationoperation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) { if (responseobject != nil && [responseobject iskindofclass:[nsdata class]]) { //some code convert responseobject nsarray //responseobject looks this: ["fsdfsf","sdfsfd"] } } failure:nil];
how can convert nsarray?
nserror *error = nil; nsarray *jsonarray = [nsjsonserialization jsonobjectwithdata: responsedata options: nsjsonreadingmutablecontainers error: &error];
Comments
Post a Comment