我在使用RESTfull Web服務時遇到了一些麻煩,我試圖將我的請求看作使用NSLog的文本。我嘗試這樣做:如何記錄AFHTTPRequestOperationManager請求?
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)的要求?
也許請求_not_失敗?你可以調試成功或失敗塊嗎? – Aaron
我的問題是,服務器說我在請求中有一個空字段(json格式)。但我添加了一個斷點來檢查值。它不是空的。所以我想也許問題是在請求結構中...... – Sebastian
因此,服務器不發送迴應? – Aaron