开发者

Network errors when initializing NSXMLParser on iPhone

开发者 https://www.devze.com 2022-12-31 03:42 出处:网络
How can I detect and properly report a connection error when executing t开发者_运维问答his line of code:

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

精彩评论

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