afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];//declares that the result of the return is JSON type manager.responseserializer = [ Afjsonresponseserializer serializer];//declares that the requested data is of the JSON type Manager.requestserializer=[afjsonrequestserializer serializer];//If the report accepts type inconsistency, replace the consistent text/html or other manager.responseserializer.acceptablecontenttypes = [ nsset setwithobject:@ "text/html"];//Incoming parameters nsdictionary *parameters = @{@ "1": @ "XXXX" @ "2": @ " XXXX ", @" 3 ": @" XXXXX "};//Your interface address nsstring *[email protected]" http://xxxxx ";//Send Request [Manager post:url parameters:parameters success:^ (Afhttprequestoperation *operation, id responseobject ) { nslog (@ "json: %@", responseobject);} failure:^ (Afhttprequestoperation *operation, nserror *error) { nslog (@ "error: %@", error);}];
Afnetworking How to post a JSON data to the server