this is my first question in here, and I would like to ask if there is anyway to update a UITableView content (rows) from a remote server, after releasing the App to the App Store.
I’m doing an App that has a UITableView filled with some people, and when you click on one of them it shows you their biography, youtube channel, twitter and facebook page.
I just want to find a way to add more people to the list every now and then, but can’t figure how to do it without having to change the TableViewController.m
What I don’t want is: having to update the App everytime I have to add something to the UITableView.
Of course that’s possible. A lot of apps do that. Like Apple’s Mail app, but also third party apps. You could use a lot of different approaches and without more precise information about your problem it’s hard to tell what’s right for you. Here are some general suggestions:
You could set up a simple RSS feed or a plain XML file on a server and poll your list from there, from time to time.
Or you could use a basic (SQL) database with a simple backend where you can modify the data. Then you can download your content from this database.
The downloading process would have to run on a separate thread so you don’t block the main one. If you use
NSURLConnectionthat’s done automatically for you. And when the download finishes, you update your table view.EDIT:
You will have to break down your problem into small pieces and solve them one by one (Divide and conquer).
First find out how you can use
NSURLConnectionto download a text file and log it’s content to the console. This shouldn’t be very difficult, just read the documentation and ask more specific questions if you don’t succeed.Then decide on what format to use (RSS, plist, plain XML, JSON, others…) and try to download and parse such a file. Plist files would be the easiest to parse, but might be harder to edit by hand on your server. There are also XML and JSON parsers available.
Depending on the complexity of your data you might want to implement some model classes and pass your downloaded information to them. If this is what you want to do, consider using Core Data to save your objects locally when the user closes your app. You could also just save the downloaded file to disk using
NSFileManager.The last step will be to populate your table view with the data that is now stored locally on the phone. This shouldn’t be very difficult and there are a lot of tutorials about this.