AFNetworking: How do I measure HTTP request and response times?

386 Views Asked by At

Trying to debug AFNetworking in my application. I need to capture the time of both request and response time to get the duration.

The duration will help me to set a reasonable timeout for the GET operation. The default 60 seconds timeout is not enough.

How do I get the request and response time? Is it part of the AFHTTPRequestOperation object?

[[AFHTTPRequestOperationManager new] GET:@"http://www.example.com"
    parameters:nil
       success:^(AFHTTPRequestOperation *operation, id responseObject) {                       
           NSLog(@"startTime={} endTime={}");
       }
       failure:^(AFHTTPRequestOperation *operation, NSError *error) {
           NSLog(@"startTime={} endTime={}");
       }
];
0

There are 0 best solutions below