PubSub 框架 +核心数据?
是否可以将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以将 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.
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