MWFeedParser 帮助代码

发布于 2024-12-03 02:45:55 字数 758 浏览 0 评论 0原文

我正在使用 https://github.com/mwaterfall/MWFeedParser 在我的应用程序中下载提要,需要一个 URL 和其中的提要,我想获取多个 URL 来提要,所以我想出了这个:

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];
    }

但是如果您在提要时刷新提要,它会显示两个或多个相同的提要tbaleView,使用 MWFeedParser 解析多个 URL 的最佳解决方案是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海里的那抹蓝 2024-12-10 02:45:55

我不确定您对委托做了什么,您没有在此处列出该代码,但我在我的应用程序中执行此操作:我

没有让委托直接更新表(看起来您正在这样做),而是拉出来自 MWFeedParser 的项目,并将它们保存到我的 CoreData 数据库中以供以后检索。

例如,我有一个 Feed 和 FeedItem 对象,当用户创建 feed 时,我保存 feed 详细信息,然后使用 MWFeedParser 检索 feed 项,并将其保存在数据库中作为 FeedItem 对象,与那个 Feed 对象。

然后,我的表视图将首先列出我保存在数据库中的提要,然后当单击提要时,我会导航到其提要项目。

这是假设您不希望所有提要项目都在同一个列表中。我很乐意提供更多帮助,但我需要看看您的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文