How should I stream live data to an iOS application for a ticker?
I would like to write a live ticker application on iOS where data is provided from a restful webservice JSON via Ruby. However, I am not sure about how to implement the wait between two requests (or is there a better solution for a live ticker than pulling the data?).
What are the recommended w开发者_StackOverflow社区ays of receiving live data from a webservice on iOS?
Search here for questions about ASIHTTPRequest and SBJSONParser. These are libraries with which you can make your RESTful queries and parse the response, respectively.
As for making requests repeatedly, you can accomplish this in a variety of ways, but the best, here, might be to use performSelectorInBackground:withObject:afterDelay:
(I think that's the name of it) after you finish processing the response from each request. You'll want to think about letting the user disable this behavior in favor of a manual request, I think. And, what will happen when the app is backgrounded, etc.
Do some searching here for questions already asked and answered about doing RESTful queries, JSON parsing, delayed actions, etc.
精彩评论