Pregunta

I've been looking up and down and there doesn't seem to be much documentation on this. I am just beginning development, and have no prior programming experience aside from HTML which doesn't really count.

I am able to successfully pull data with URL queries as I can see in my console. My question is, if I wanted to send a query for restaurant reviews, as an example, how do I get that data from the console to the iPhone view, right on the screen? If someone were able to provide a simple example I would appreciate it.

¿Fue útil?

Solución

I'll give you the general steps:

1) Parse the JSON (which is probably an array of dictionaries) so loop through the array with an inner loop iterating the dictionaries. You could also use JSONKit.

2) Optionally cache the data somewhere (NOTE: If you use core data, there is a nice NSManagedObject method that will basically create an NSManagedObject directly from JSON).

3) Display it using UIKit (i.e. a Table view, where each cell displays the text and images your are retrieving).

If you need any specific help with any of those steps, please post new questions as you go along -- Break it down and tackle one problem at a time.

Also, if you use Core Data to persist this JSON data, you could use the NSFetchedResultsController as the datasource for your table view, which simplifies that some too.

I know you probably wanted me to write the code for you, but you've asked a very ambiguous question, whose scope is really too broad. If you follow those steps and have specific questions, we will help you work through it as you go.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top