Andrew Lauer Barinov
Andrew Lauer Barinov

Reputation: 5754

UIWebView unable to load RSS Page

Here is my code, it doesn't seem to work for RSS pages, but works fine for google.com (or any other plain old web page), any idea why?

UIWebView *wv = [[UIWebView alloc] initWithFrame:CGRectMake(0, 510, 1024, 230)];

NSURL *url = [[NSURL alloc] initWithString:@"http://feeds.marketwatch.com/marketwatch/topstories/"];

NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];

[wv loadRequest:request];

Upvotes: 0

Views: 240

Answers (1)

jonkroll
jonkroll

Reputation: 15722

The Marketwatch RSS URL you are using in your example returns XML, not HTML. The reason it looks like HTML when you view it in a browser is that it has an xml-stylesheet attached to it that the browser is using to render a human-readible view. However the UIWebView component does not do the same thing.

For your purposes you'd probably want to request this XML, parse it, and use the contents in a UITableView.

Upvotes: 1

Related Questions