MWFeedParser 帮助代码
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您对委托做了什么,您没有在此处列出该代码,但我在我的应用程序中执行此操作:我
没有让委托直接更新表(看起来您正在这样做),而是拉出来自 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.