NSMutableURLRequest*request = [NSMutableURLRequestrequestWithURL:[NSURLURLWithString:url]];
[request setTimeoutInterval:ACTION_TIMEOUT];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded"forHTTPHeaderField:@"Content-Type"];
request.HTTPBody=@"key1=value1&key2=value2....";
AFHTTPRequestOperation* operation = [[AFHTTPRequestOperation alloc] initWithRequest:_request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation,idresponseObject) {
NSLog(@"operation hasAcceptableStatusCode: %d", [operation.response statusCode]);
} failure:^(AFHTTPRequestOperation *operation,NSError*error) {
if(error.code !=NSURLErrorTimedOut) {
NSLog(@"error: %@", error);
}
}];
[operation start];
HTTPBody需要从NSString转NSData