NSURLConnection timeoutInterval only works in multiples of 30 seconds
NSURLConnection timeoutInterval only works in multiples of 30 seconds
- Subject: NSURLConnection timeoutInterval only works in multiples of 30 seconds
- From: email@hidden
- Date: Sat, 05 Jul 2008 18:55:12 -0400
Hi,
I am trying to do a periodic update based on the contents of a url, but when the website is down with 5** error, I would like to not wait more than a couple of seconds. So, I wrote the following code :
url = [NSURL ...];
updateTimer = [[NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(update:)
userInfo:nil repeats:YES] retain];
[updateTimer fire];
-(void)update:(id)sender
{
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:5];
NSURLResponse *urlResponse;
NSLog(@" Before ");
NSData *urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&urlResponse error:&error];
NSLog(@" After : Error = %@ ",error);
.....
.....
}
But when i run the app, the "After" statement with "timed out" message is logged after 30 seconds from the "Before" statement. When I set the timeoutInterval between 30.1 to 59.9, it is printed after 60 seconds and so on. I don't know how to get it to work in desired time intervals. Any help would be appreciated.
Thanks
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden