werbary
werbary

Reputation: 1095

feed://... in my UIWebView

I want to open RSS Feed in my UIWebView, but it isn't working and opening Safari. My code:

NSString *link = [[NSString alloc] initWithFormat:@"feed://smartfiction.disqus.com/%@/latest.rss", slug];
    NSURL *url = [NSURL URLWithString:link];
    NSURLRequest *requestWeb = [NSURLRequest requestWithURL:url];
    [webViewComment loadRequest:requestWeb];

I found right way. I have created rss parser and showed feed in UITableView. It's more beautiful and easy.

Upvotes: 0

Views: 318

Answers (1)

Zigglzworth
Zigglzworth

Reputation: 6823

feed:// is a URL Scheme which is handled by Safari and so will only be opened by Safari... you could try :

 NSString *link = [[NSString alloc] initWithFormat:@"feed://smartfiction.disqus.com/%@/latest.rss", slug];
NSURL *url = [NSURL URLWithString:link];
NSData *rssData = [NSData dataWithContentsOfURL:url];
[webViewComment loadData:rssData MIMEtype:@"application/rss+xml" textEncodingName:@"utf-8" baseURL:nil];

Upvotes: 1

Related Questions