开发者

MWFeedParser help with code

开发者 https://www.devze.com 2023-04-03 04:14 出处:网络
I am using https://github.com/mwaterfall/MWFeedParser to download feeds in my app, it takes one URL and feeds from it, I wanted to take multiple URLs to feed from so I came up with this:

I am using https://github.com/mwaterfall/MWFeedParser to download feeds in my app, it takes one URL and feeds from it, I wanted to take multiple URLs to feed from so I came up with this:

for开发者_运维问答 (NSString *rssUrl in [Data variables].categories) {
        NSString *link = [[Data variables].rss objectForKey: rssUrl];
        NSURL *feedURL = [NSURL URLWithString: link];
        feedParser = [[MWFeedParser alloc] initWithFeedURL:feedURL];
        feedParser.delegate = self;
        feedParser.feedParseType = ParseTypeFull; // Parse feed info and all items
        feedParser.connectionType = ConnectionTypeAsynchronously;
        [feedParser parse];
    }

But it has a bug if you refresh the feed while it's feeding, it will show two or more same feeds in tbaleView, what would be the best solution to parse more than one URL with MWFeedParser?


I'm not sure what you do with your delegate, you don't list that code here, but I do this in my application:

Instead of having the delegate update a table directly, which it appears that you are doing, I pull the items from MWFeedParser, and save them into my CoreData database for later retrieval.

For example, I have a Feed, and FeedItem object, and when a feed is created by the user, I save the feed details, then I use MWFeedParser to retrieve the feed items, and save those in the database as FeedItem objects, related to that Feed object.

Then, my table view will first list the feeds that I have saved in the database, and when a feed is clicked on, I then navigate to its feed items.

This is assuming you don't want to have all the feed items in the same list. I would be happy to help more, but I would need to see what your delegate code for MWFeedParser is doing.

0

精彩评论

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