tags:

views:

273

answers:

3

I'm currently creating an iPhone app where in one part of my app you can view your twitter stream. I'm unsure if I need to ever save the twitter information to a sqlite database or not.

So here is the flow of this part of the app:

  1. press button to see twitter stream
  2. go get twitter stream
  3. display twitter stream in table view

I'm wondering if I should ever save the twitter stream into a database. Any advice?

A: 

If you won't ask the user to provide his/her twitter credentials and it will be an anonymous stream, you don't need to store anything.

But the minute you want to store some preferences, actual state (to show the user what he/she was seeing when a phone call came or after application restart) you will need to store persistent data.

Pablo Santa Cruz
A: 

I think it's important to cache web data. With a cache, you can present data immediately on app startup - this is important on the iPhone OS because users are constantly opening and closing apps. Having your data immediately available is a big win for the user.

You can make the caching very simple, just have a single table with the URL as one column and the HTTP response as a second. Then you don't have to change any of your code to make the caching happen.

Alternatively, you will need to define a data model and manage that through CoreData or sqlite.

Frank Krueger
+1  A: 

I would say you should save the twitter stream. You should almost always try to save some application state in an iPhone app. This way, if the user is interrupted (a phone call) they can jump back into your app without missing a beat.

There are a few different ways to persist data in an iPhone app. Instead of bothering with using a SQLite database you will almost certainly want to use Core Data, which is new in iPhone OS 3.0

bpapa