PubSub 框架 +核心数据?

发布于 2024-10-13 19:18:55 字数 126 浏览 8 评论 0原文

是否可以将 PubSub 框架对象持久保存在 Core Data 持久存储中?或者有更好的方法来做到这一点......?我正在开发 RSS 阅读器,并寻找缓存 PubSub 检索的 RSS/Atom 提要的方法。

提前致谢

Is it possible to persist PubSub framework objects in a Core Data persistent store? Or is there a better way to do this...? I'm working on an RSS reader and looking for ways to cache RSS/Atom feeds retrieved by PubSub..

Thanks in advance

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

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

发布评论

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

评论(2

弃爱 2024-10-20 19:18:55

可以将 PubSub 对象保存在持久存储中,但是,我不确定是否需要它,因为我相信这些对象保存在操作系统数据库中。

无论如何,要做到这一点,您所要做的就是添加一个可转换的属性,即 feedObject。该文档对如何执行此操作有很好的解释:DOCS

唯一真正的技巧是您必须在实体头文件上导入 PubSub 框架。

正如我所说,只要您订阅了提要,提要和相关条目就会一直保留在操作系统中(我相信)。它检索条目的唯一时间是 (a) 当您首次订阅提要时和 (b) 当它决定刷新提要时。

如果您不订阅提要并且仅手动获取提要,那么您可能需要考虑将它们添加到持久存储中。

It is possible to persist PubSub objects in the persistent store, however, I am not sure if it is needed as I believe those objects are persisted in an operating system database.

Regardless, to do this, all you have to is add a transformable property, i.e. feedObject. The docs have a good explanation of how to do this:DOCS

The only real trick is that you have to import the PubSub framework on the Entity header file.

Like I said though, the feeds and associated entries are all persisted (I believe) in the operating system as long as you subscribe to the feed. The only time it retrieves entries is (a) when you first subscribe to a feed and (b) when it decides that is time to refresh the feed.

If you don't subscribe to the feed and you are only taking the feeds manually then you might want to consider adding them to your persistent store.

一萌ing 2024-10-20 19:18:55

Mac 开发者网站上有一个关于阅读新闻源的示例。单击此处可以下载示例代码。希望它对您有用。

此处科林·惠勒

there is an example in the mac developer site regarding reading news feeds. The sample code can be downloaded by clicking here. Hope it will be useful for you.

here is another example by Colin Wheeler

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