0

我有一个这样创建的 NSMutableURLRequest:

AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:<my url>];
urlRequest = [httpClient requestWithMethod:<my method>
                                      path:<my uri>
                                parameters:<my parameters>];

在我的程序稍后的某个时刻,我希望在运行网络操作之前​​将其他参数附加到urlRequest(同时保持其他所有内容不变)。我该怎么做呢?

4

1 回答 1

0

寻找 AFNetworking 它返回一个 NSMutableRequest 对象。​​​

- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
                                      path:(NSString *)path
                                parameters:(NSDictionary *)parameters

现在,根据您正在执行的请求类型,(GET,POST,PUT,DELETE)您可以通过以下方式访问请求参数:

GET:request.URL.parameterString

POST:request.HTTPBody

于 2013-09-12T01:11:14.887 回答