ios - Cancel Post request in Afnetworking 2.0 -
hi making post request using afnetworking 2.0. request looks this.
afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; manager.responseserializer = [afxmlparserresponseserializer serializer]; [manager.requestserializer setvalue:@"some value" forhttpheaderfield:@"x"]; [manager post:url parameters:params success:^(afhttprequestoperation *operation, id responseobject) { //doing } failure:^(afhttprequestoperation *operation, nserror *error) { // error handling. }];
how can cancel request???
post
method return afhttprequestoperation
operation. can cancel calling cancel
.
afhttprequestoperation *post =[manager post:nil parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { //doing } failure:^(afhttprequestoperation *operation, nserror *error) { // error handling. }]; //cancel operation [post cancel];
Comments
Post a Comment