-(ID) Executebyoperationmanager
{
Afhttprequestoperationmanager *manager = [self afnetworkoperationmanager];
Afjsonrequestserializer *requestserializer = [Afjsonrequestserializer serializer];
[Requestserializer setvalue:@ "Application/json" forhttpheaderfield:@ "Content-type"];
[Requestserializer setvalue:@ "Application/json" forhttpheaderfield:@ "Accept"];
Manager.requestserializer = Requestserializer;
Manager.securitypolicy.allowinvalidcertificates=yes;
Manager.responseSerializer.acceptableContentTypes =
[Nsset setwithobjects:@ "text/html", @ "Text/json", nil];
Afhttprequestoperation *operation = [Manager POST: (NSString *) [self GETURL]
Parameters:[self Getbodyparam]
success:^ (afhttprequestoperation *operation, id responseobject) {
[Self onrequestsuccess:responseobject];
[Self invokecomplete];
}
failure:^ (afhttprequestoperation *operation, Nserror *error) {
if (operation.responseobject) {
[Self onRequestSuccess:operation.responseObject];
}else{
[Self onrequestfailed:error];
}
[Self invokecomplete];
}];
[Operation start];
return operation;
}
IOS POST request set request header