Web service sends data to iOS client, and client shows data with UITableView.
Data is usually article of built-in board, text list. It is sent from web service via json format. (sometimes XML)
It doesn’t need to be updated in real-time, but I don’t want to block UI due to loading of web service.
There’s many ways to implement it, which way do you proper? 1. or 2. ?
-
UITableViewController handles json object.
Simple way, but it can be complicated to coding up.
-
Use CoreData as local database.
There’s local repository for articles, when json data is came from web service, it updates local CoreData repository. (async web service load)
and UITableViewController <> handles update of local CoreData repository, and update UITableView with animation.
I think second way is better to implement without spaghetii code, but I’m afraid there’s other performance issue, or isn’t it totally stupid code?
Friends, how do you implements list of data from web service usually?
More comments:
I found SeismicXML example from Apple SDK, it is well-implemented example of way 1.
but I think it can be implemented easily by using CoreData as local repository.
-
Get data from web service (async), and put data into CoreData
-
UITableViewController updates UITableView in NSFetchedResultsControllerDelegate methods.
How do you think of this strategy?
Check out RestKit. They have an example of a discussion board client for iPhone that gets it’s data from a discussion board server (also supplied in the example – built on rails) via json and stores it to core data db on the iphone. very elegant imo.
http://restkit.org/