我試圖使用AFNetworking來發布XML-RPC請求。 AFNetworking函數庫僅爲表單數據提供節流( AFMultipartFormData
)。用AFNetworking調節POST
如何節流常規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]);
}];
你想有一個延遲發送二進制文件時只使用限制,你想限制數據包大小或者你想兩個都做? – 2013-03-22 17:20:35