Take the 2-minute tour ×

I am sorry if the title is unclear. Allow me to elaborate further.

Firstly, I have an application on an iPhone that will allow the user to upload a data to server. We simply use php to allow the user to upload the data. Secondly, the server will process this data and then return the processed data back to this iPhone. This part is the part that I am still having trouble.

My question is "how to make the server send the processed data back to the invoking iPhone?" Are there some sort of "listening to server" method in iPhone SDK or there are other ways to consider? In the case of some errors in connection, is it possible for the server to know which iPhone to send the data back to?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Well the iPhone is able to make HTTP requests, as you will have to do to send the data to your PHP app on the server. In the HTTP response is where you'll put the processed data. You'll want to look at The URL Loading System doc for info on how to use it. The response you get back will be in something like XML or maybe JSON, in which case you can use a 3rd party library.

If you can't do this in one request - for example if your server side processing takes hours - the only way you'll be able to send the data back is with a Push Notification. There's no listening web server that is running on the iPhone that you would be able to send requests to.

share|improve this answer
thats (Push Notification) not the only way,you can use polling for example to get back the response, and there is probably a way of programing a socket to get data pushed in –  Daniel Nov 20 '09 at 14:29
not to mention making an async request, in which the data will come back eventually if they have programmed the web service to reuturn a response (as long as the app is open) –  Daniel Nov 20 '09 at 14:30
Can you provide an example of how this polling works? Isn't that for media playing or something and doesn't it lock up the main thread? –  bpapa Nov 20 '09 at 19:15
add comment

Your Answer


