title: AFHTTPRequestOperation times out
body: <p>I have a few web services calls in my app. Here is an example of how I'm calling them </p>
  
  <pre><code>+(void) login:(NSDictionary *) loginParams {
  
      AppDelegate *appDelegate  = (AppDelegate *)[[UIApplication sharedApplication] delegate];
      NSString * URLString = [MPTLogin getLoginWSAddress];
      AFHTTPClient* client = [[AFHTTPClient alloc]initWithBaseURL:[NSURL URLWithString:URLString]];
      NSMutableURLRequest *request = [client requestWithMethod:@"POST"
                                                      path:URLString
                                                parameters:loginParams];
      AFHTTPRequestOperation* operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
      [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
          [[NSNotificationCenter defaultCenter] postNotificationName:@"didSuccessfullyAttemptLogin" object:nil userInfo:nil];
  
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          if ([operation.response statusCode] == 401)
              [[NSNotificationCenter defaultCenter] postNotificationName:@"invalidUserNameOrPassword" object:self userInfo:nil];
  
          else
              [[NSNotificationCenter defaultCenter] postNotificationName:@"didFailedAttemptLogin" object:self userInfo:nil];
      }];
  
      [operation start];
  }
  </code></pre>
  
  <p>The issue is, if no web service is called in 5-15 minutes, the next web service called times out. Then any calls after that take only an instance of a second to complete, untill there is no calls are made for a few minutes. Then the same things happens again.</p>
  
  <p>This only happens on device. Simulator is fine. Also, this is not a wifi issue. I am totally lost as to how I can debug this.</p>
  
  <p><strong>Update</strong>: So I checked the server logs and the calls do not arrive on time.
  I also tried using <a href="http://www.charlesproxy.com/" rel="nofollow">Charles Proxy</a>. The most bizarre thing happened. When the proxy is on, the time out does not happen. In fact, the calls almost happen instantly. But when I take off the proxy, the same issue happens.</p>
  
  <p><strong>Update:</strong> This is not a wifi issue because we have tried it on different devices, different wifi connections, in different states.</p>
  
  <p><strong>Update</strong> So I ended up setting the timeouts to 150 seconds. Now, I have fewer timeouts but the problem is that whenever I get a timeout, the console says it took 60ish seconds. Also the timeout code is -1001</p>