我正在尝试使用AFNetworking发布 XML-RPC 请求。AFNetworking 库仅提供对表单数据的限制(throttleBandwidthWithPacketSize:delay:
on AFMultipartFormData
)。
如何限制常规NSData
POST 请求?
这是我当前的代码:
XMLRPCEncoder* encodObject = [[XMLRPCEncoder alloc] init];
[encodObject setMethod:function withParameters:[NSArray arrayWithArray:parametrs]];
NSMutableURLRequest *request = [afClient requestWithMethod:@"POST"
path:path
parameters:Nil];
NSData* body = [[encodObject encode] dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:bodyRequest];
AFHTTPRequestOperation* operationAf =
[[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:
^(AFHTTPRequestOperation *operation, id responseObject) {
NSString* response = operation.responseString;
NSLog(@"response %@,response");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error%@", [error localizedDescription]);
}];