• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLConnection how to handle 502 error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection how to handle 502 error


  • Subject: Re: NSURLConnection how to handle 502 error
  • From: Kanny <email@hidden>
  • Date: Mon, 07 Jul 2008 11:27:44 -0400

I am still trying to find a solution to quickly resolve the web server 502 error using NSURLRequest and NSURLConnection. Right now, even if i set timeoutinterval to 5 seconds, it takes 30 seconds. But more painful thing is that during that time, it makes the app unresponsive with the beach ball spinning. Let me know your strategies to handle 502 error. I would like something like Safari, it does take time (60-90 sec) to display the error message, but it doesn't halt the user's interaction with other tabs or windows of safari.

Alternately, is there a way to specify a strict time duration for a particular action to execute and return nil if it can't.

Thanks.

-----Original Message-----
From: email@hidden
To: email@hidden
Sent: Sun, 6 Jul 2008 4:25 am
Subject: NSURLConnection timeoutInterval only works in multiples of 30 seconds



Hi,

I am trying to do a periodic update (every 1 minute) 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


  • Follow-Ups:
    • Re: NSURLConnection how to handle 502 error
      • From: Mike Abdullah <email@hidden>
References: 
 >NSURLConnection timeoutInterval only works in multiples of 30 seconds (From: email@hidden)

  • Prev by Date: Re: Efficiently receiving data from an NSTask
  • Next by Date: Re: Efficiently receiving data from an NSTask
  • Previous by thread: Re: NSURLConnection timeoutInterval only works in multiples of 30 seconds
  • Next by thread: Re: NSURLConnection how to handle 502 error
  • Index(es):
    • Date
    • Thread