I'm building a social app with features including feed, profile, friends and followers. I'm using core-data to save all the objects persistently. When a user launches the app the data is fetched from core-data and displayed to the user instantly, but I'm also fetching updates in the background.
The problem is that currently I'm saving everything in core-data. For instance, if I visit a friends profile, I fetch the friend's feed objects and save those in core-data too. Now the next time I visit the same friend's profile, I just show the saved feed initially (and update in the background).
Should I be doing this? Is there any problem with saving everything in core data (for a better user experience), or are there any limitations or problems that might occur when the data set grows larger? Are there some good practices that I must follow in terms of what to save and what not to save persistently?
Thanks
While in principle you can use your approach in order to immediately show some data, there are some significant tradeoffs. On the whole, I think your approach is problematic.
Compare your situation with the Mail app on the iPhone (at least when you are using a mail server with some latency.) When you open a mailbox you will see old messages as well as a spinning wheel indicating that an update is running. Then, suddenly, the display is updated with all your new messages. Your approach is very similar to this.
That might be OK for mail messages, but is it really acceptable for news feeds and status messages? I don't think so. Stale status messages (think "I'm feeling blue.") when the situation has already changed (think "I'm feeling great.") are misleading and will result in a dismal user experience.
Your Core Data store could still store all of the data and periodically wipe itself. The initial fetch could be such that items older than a certain threshold are not shown (and deleted). At the same time, it makes perfect sense to persist more permanent data (such as the friends list).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With