Currently, i use the following:
[tmp1 setString: [NSString stringWithContentsOfURL: [NSURL URLWithString: @"http://www.SomeWebSite.com/"] encoding: NSASCIIStringEncoding error: nil]];
is there a way to set it to a timeout of 1-2 seconds if the website doesn't respond in that period of time? I don't want the user to wait the full 3-4 minutes before the system times out if the site's not available.
David Phillip Oster - 30 Oct 2006 01:58 GMT
> Currently, i use the following:
> [tmp1 setString: [NSString stringWithContentsOfURL: [NSURL URLWithString:
> @"http://www.SomeWebSite.com/"] encoding: NSASCIIStringEncoding error: nil]];
> is there a way to set it to a timeout of 1-2 seconds if the website doesn't
> respond in that period of time? I don't want the user to wait the full 3-4
> minutes before the system times out if the site's not available.
You can make a NSURLRequest with a NSURL and set the timeout time. Use a
NSURLConnection to run the NSURLRequest.