开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜