ios - AFNetworking How to send a string of post request? -


afnetworking how send string of post request?

//restrinbase64string nsstring ,program error [manager post:urlstring parameters:restrinbase64string success:^(afhttprequestoperation *operation, id responseobject) {  } failure:^(afhttprequestoperation *operation, nserror *error) {  }]; 

solve problem

nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request seturl:[nsurl urlwithstring:urlstring]]; [request sethttpmethod:@"post"]; nsmutabledata *postbody = [nsmutabledata data]; [postbody appenddata:[restrinbase64string datausingencoding:nsutf8stringencoding]];  [request sethttpbody:postbody]; afhttprequestoperation *operation = [[afhttprequestoperation alloc]initwithrequest:request];  operation.responseserializer = [afhttpresponseserializer serializer];  [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) {  } failure:^(afhttprequestoperation *operation, nserror *error) {  }]; [[nsoperationqueue mainqueue] addoperation:operation]; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -