elp
elp

Reputation: 8131

Catch server timeout on calling xml

[[NSXMLParser alloc] initWithContentsOfURL:@"www.mysite.com/myXml.mxl"];

to get xml and after that i use parser funcions.

Now, if the server is down? or responding too slow, is there a way to set / get server timeout response in NSXMLParser ??

thanks

Upvotes: 0

Views: 534

Answers (1)

Aurum Aquila
Aurum Aquila

Reputation: 9126

I would recommend using something like ASIHTTPRequest or NSURLConnection to pull your data. They provide more control over this sort of thing. These libraries support advanced features like timeouts and ASI even includes the ability to track progress of a download. Very useful for giving your app that touch of usability flow.

You can pull an NSData out of them, then pass it to the NSXMLParser with [[NSXML Parser alloc] initWithContentsOfData: data];.

If you have any more questions, just comment :)

Good luck,

Aurum Aquila

Upvotes: 2

Related Questions