I have a ios device and a web service written in php. When the ios device send a request to the web service, the web service will response to that exact ios device. I don’t know how can server send response to that device.
Thanks for your help!
I have a ios device and a web service written in php. When the
Share
You can research into each of these individual components:
1) App make a HTTP POST request to web service with a callback delegate method (ASIHttpRequest or AFNetworking)
2) Server receives request, parses it, then constructs a JSON response and return it back to the app automagically (use a web framework)
3) In your app’s delegate callback method, you will parse the JSON data as a NSDictionary. You extract the JSON key-values using [yourDictionary valueForKey:@”name”];, [yourDictionary valueForKey:@”age”], [yourDictionary valueForKey:@”gender”], [yourDictionary valueForKey:@”email”] etc.
Then your app can either show the parsed data on the screen or do other things with it.
EDIT
Since you’re using PHP as the web service language, I recommend using Symfony 2 web framework.
You’ll write something like
Alternatively, if you want scalable applications, you can use Node.js (server side Javascript)