开发者

iPhone - dataWithContentsOfURL: does not work for some URLs

I am using NSData to get content from a URL (RSS feed) and then parse it. While most of the URLs are loaded fine, some of them don't return any data.

These URLs open on the web so I know they are valid, but they just don't return any NSData. One such URL - feed://jpl.nasa.gov/multimedia/rss/rovers.xml

Here's how I am using it (the NSURL object is formed properly)

NSURL *feedURL = [NSURL URLWithString:[myUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSData *data = [NSData dataWithContentsOfURL:feedURL开发者_JS百科];

Any ideas why?

Thanks a lot.


Switch to NSURLConnection so you have some delegate methods to watch what's happening in debugger. check out the URL Loading System docs if you haven't.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜