I am calling a web service from my iOS application, which can take up to four minutes. I use RestKit to call and load objects. I find that when requests take a long time, I get a timeout error after ~ 60 seconds. I tried setting the Interval timeout to absurd amounts, but it still expires after ~ 60.
RKObjectManager* objectManager = [RKObjectManager objectManagerWithBaseURL:HOSTNAME]; objectManager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; objectManager.client.disableCertificateValidation = YES;
Here is the service call:
- (void)loadData { NSString *uid = [self retrieveFromUserDefaults:@"login_preference"]; NSString *pwd = [self retrieveFromUserDefaults:@"password_preference"]; if([uid isEqualToString:@""] || [pwd isEqualToString:@""]){ [self stopSpinner]; [self enableUserInterface:YES]; UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Missing Settings" message:@"Please enter your login information in the settings." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; return; } RKObjectManager* objectManager = [RKObjectManager sharedManager]; NSDictionary *params = [NSDictionary dictionaryWithObjects: [NSArray arrayWithObjects:uid, pwd, nil] forKeys:[NSArray arrayWithObjects:@"uid", @"pwd", nil]];
}
I am making a web service call in the background thread - is there something in this design that might cause the problem? I can not imagine how, for example, iOS, not allowing background threads to work for more than 60 seconds? I just can't figure out what the problem is.
Is there a timeout for receiving a response from a server or receiving a WHOLE response from a server? I am returning a potentially very large json response - do I need to return all this within a timeout, or do I just need to get any response from the server within the limit?
Michaela
source share