【发布时间】:2014-03-27 16:09:09
【问题描述】:
我在使用 RESTfull Web 服务时遇到了一些问题,我正在尝试使用 NSLog 将我的请求视为文本。我试过这个:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
...
[manager POST:urlString parameters:mutableParameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
...
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Response: %@", [operation description]) ;
if (block) {
block(error);
}
NSLog(@"-------------------------------");
NSLog(@"Request: %@", manager.requestSerializer.debugDescription);
NSLog(@"-------------------------------");
NSLog(@"Request: %@", manager.requestSerializer.description);
NSLog(@"-------------------------------");
NSLog(@"Request: %@", operation.request.HTTPBodyStream);
NSLog(@"-------------------------------");
NSLog(@"Request: %@", operation.request);
NSLog(@"-------------------------------");
NSLog(@"Error: %@", error);
NSLog(@"-------------------------------");
}];
有没有办法 NSLog 来自 AFHTTPRequestOperationManager (AFNetworking 2) 的请求?
【问题讨论】:
-
也许请求没有失败?您可以调试成功或失败块吗?
-
我的问题是服务器说我的请求中有一个空字段(json格式)。但是我添加了一个断点来检查值。它不为空。所以我认为问题可能出在请求结构中......
-
所以服务器没有发回响应?
标签: ios objective-c afnetworking-2