Network errors when initializing NSXMLParser on iPhone
How can I detect and properly report a connection error when executing t开发者_运维问答his line of code:
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:feedUrl];
Is there a clean way to do it or will I have to break this up code up into NSURLRequest, NSURLConnection, etc...
You can check the return value. If it is nil, something went wrong. If you want to know, if the URI wasn't valid, the server did not respond, the data were invalid, you need to use an NSURLRequest.
精彩评论