iPhone live data streaming - iphone

We have an application with charts. Client wants to implement something like in forex graphs, I mean live data, updating for example each 1, 5 or 10 seconds. Could you please provide me with some theory, how would it be possible to implement, what iOs objects should I use? What should the data provider implement?

I think you are using API s to receive live data to your application. its better that APIs are using JSON format to send data. because those are easy to use. If the data receiving in XML format then its little bit hard. There is JSON class library in the internet to download. Download it and integrate it your application and after that you can use it very easily.
http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/
here is a tutorial. you can refer it and its easy :)

Data for charts should locates on any server side. Create separate thread with requests or async requests to your/clients server side. This will make your requests in the background and users of your application will not be distracted by endless stop/pause during the application lifecycle. Also in the background you should parse received data from server. There are multiple available formats for this aim (JSON in prev post, for ex.). Parse data and update your charts datasource. If your use CorePlot for building charts it's pretty straightforward to refresh charts with new data - use on these CPGraph methods
-(void)reloadData; -(void)reloadDataIfNeeded;
Check NSURLConnection for asynchronous loads of a URL request. NSOperation for start you code in background.

Related

Getting the progress of the sent data through Zend Rest service

I have the following situation. We are using Zend Framework to create a web application that is communicating with it's database through REST services.
The problem I'm facing is that when a user tries to upload a big video file for example, the service is taking some time (sometimes a few minutes) to receive the request (which is also sending the video file encoded with base64_encode PHP function.) and returns the response for successful save or error.
My idea is to track how much of the data is sent and show the user a JS progress bar, which will be useful in these cases.
Does anyone have an idea, how I can track how much of the data is sent through the service and based on this I'll be able to show a progress bar?
Zend provides progress bar functionalities that might be paired with some javascript/jquery client.
You will easily find some example implementations like this one:
https://github.com/marcinwol/zfupload
However I don't think that REST services are the best solution for uploading videos as base64 encoding will make files bigger and slower to upload.
Check out Zend_File_Transfer that might be better suited to your needs:
http://framework.zend.com/manual/1.12/en/zend.file.transfer.introduction.html

Design patterns when working with JSON web service and Core Data?

I have a iPhone app which loads json from my webservice.
I think its a good idea to store the data with Core Data but how should I sync the data with my webservice?
For example, say that I show a UITableView with the information stored in Core Data, and then I would like to update the object.
Are there any design patterns or ideas for this?
Each time your app loads it should try to load info from the web service. If it can't connect, use the local data. You should timestamp your data on the server and in the app so that you can track when the information was last updated. You can also offer a button to manually refresh the data. (Like the Mail app.)
EDIT:
To make asynchronous requests, you can see the ASIHTTPRequest library.

fully web based iphone client-server application?

I want to create one simple application for sending request from iphone(client) by using http protocol to the server for adding two integer numbers.server process the request and return the response to the client that is my iphone.retrive the result from server and show the result in my iphone.plz giv me a step by step procedure for implement this app.
and also give the detailed explanation for which language is supported for writting the code for implement this application and what are the proticols are used to send the request...
how to retrive the result from server by using which kind of parser like,(xml...)
i'm waiting for ur reply...
Thank u...
There is a good tutorial on the apple developer site on how to make a http request and receive data here.
All app written to the iPhone is done in Objective C using the framework supplied by apple.
The protocol used is http.
If you implement the server part, then you decide what kind of format the result should be. In most cases, depending on the result you want to return, this would be xml. It could also be binary data if it is something like an image.

CoreData and ASP.NET webservices

I'm developing an iPhone app that relies heavily on calling ASP.NET Webservices to transfer data to and fro between a database in one of our servers and the phone.
There are multiple items that the user works on. And to work on each item, a typical usecase requires 5-6 webservice calls. Depending on 3G signal strengths, the amount of data that's being downloaded and the number of items each day, it takes any where between 5-6 minutes of time just to keep the user looking at the spinning wheel.
This is simply not acceptable, so, basically I want to be able to asynchronously keep both the app and the database on the server side in sync.
How would I go about doing this? (I'm currently not using CoreData at all, but I'm guessing I probably need to use it now).
Thanks,
Teja
You will need to code the glue beteeen core data and your restful web service. Try and design your data model to match the data coming back from the web service and that will make the glue easier to manage. If you can get the data in JSON then the glue will be even less.
Core Data is an object hierarchy and you will need to approach it like that when you design your caching and syncing code.
Update
The tableview has nothing to do with the data. When you are working with Objective-C and iOS you need to think in terms of MVC. So you need to be thinking about watching delta changes in your Model (the UI or view portion of MVC is irrelevant). Core Data easily lets you do this during a save operation and you can take those deltas and push them back up to the server. The tricky issue is how to get notifications from the server of changes server side. That is something that is dependent on the server design.
Processing changes from the server should be done on a background thread (with a separate NSManagedObjectContext connected to the same NSPersistentStoreCoordinator) and the main thread should be watching for save notifications from that background thread so that it can update the UI as needed.
This is a non-trivial design and the complexity means that you can and will run into issues but those issues are dependent on your application and server design. There is no silver bullet other than the fact that using Core Data makes all of this a lot easier.

exporting Flurry.com data

I have been using Flurry.com to capture my analytical data for my iPhone app. I send them custom event information about what is going on in my application (registration/login/etc). I pass extra information with these events. Now I want to access this information and analyze it. How do I do that?
On their website I can see small 'pages' of information captured from my app. I can even 'export to CSV' a small 'page' of this data. But I do not see a way to export all of the data for a given period of time. Am I missing something?
I found api.flurry.com RESTful API today, but again it looks like I can only make two different calls that seem kind of useless (AppMetrics/AppInfo) and only return information for canned metrics. I really want to get at the custom events and custom event data that I sent to them. Is there a way to do this?
Thanks for any help.
There now appears to be EventMetrics API call, it allows you to request information about your Events.
I received the following response from Flurry:
I apologize for the inconvenience. We will eventually be expanding Flurry's API functionality to include events data. But until that occurs you should be able to access your event's data via Flurry's CSV files.
It looks like my data is stuck inside of Flurry.com right now. I think I better re-think my analytics strategy. I need my data out of Flurry.com and into my own data warehouse!
Update:
Flurry has now implemented its events data API. However, if you want to do custom analytics on the custom data that you send, you will probably be disappointed. The output of a call to the events data API is a summary, not your original logs.