ios - Convert NSData object to NSArray -


this question has answer here:

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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -