iOS: best way to cache downloaded rss messages
-
28-09-2019 - |
Pergunta
I'm implementing what essential amounts to an RSS reader for iPhone. I download a bunch of short messages and display them to the user in a list. Each message is encapsulated in a MyMessage object that contains the title, the body, url, etc.
I want to be sure to cache the 20 most recent messages. What is the best way to do this? Should I use a keyed archive, and just have the MyMessage class implement the NSCoding protocol. If I choose this approach, can I append new message to the file containing the archive (and similarly, can I delete old messages when the message count exceeds 20)?
Essentially my question is: is using a keyed archive the right approach? And if so, how can I append/delete messages from the archive as necessary?
Thanks!
Solução
Why not use CoreData? Its fairly trivial to make that work with your simple object to cache.