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

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -